diff options
115 files changed, 985 insertions, 642 deletions
diff --git a/.bzrignore b/.bzrignore index 0a72b402ca9..bacfe2ff975 100644 --- a/.bzrignore +++ b/.bzrignore @@ -505,3 +505,11 @@ vio/test-sslserver vio/viotest-ssl sql_error.cc sql_prepare.cc +autom4te.cache/* +innobase/autom4te.cache/* +configure.lineno +innobase/configure.lineno +innobase/stamp-h1 +myisam/rt_test.MYD +myisam/rt_test.MYI +stamp-h1 diff --git a/BitKeeper/etc/gone b/BitKeeper/etc/gone index 5f2b9e1209d..204044a2cc5 100644 --- a/BitKeeper/etc/gone +++ b/BitKeeper/etc/gone @@ -199,7 +199,9 @@ BK|sql-bench/Results/ATIS-mysql-3.21-Linux_2.2.1_i686|19700101030959|02022|660fb BK|sql-bench/Results/ATIS-mysql-Linux_2.2.10_i686|19700101030959|02025|3fa4d167cceff7e8 BK|sql-bench/Results/ATIS-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02312|84ca3b85ff306133 BK|sql-bench/Results/ATIS-mysql-Linux_2.2.14_i686_xeon|19700101030959|02044|3e820c28bf4af63a +BK|sql-bench/Results/ATIS-mysql-SunOS_5.5.1_sun4u|19700101030959|02031|dfb4c5f6b6db3b49 BK|sql-bench/Results/ATIS-mysql-SunOS_5.6_sun4m|19700101030959|02032|62028e0375b3b8b +BK|sql-bench/Results/ATIS-mysql-SunOS_5.7_sun4u|19700101030959|02034|be0d9789776c5ed7 BK|sql-bench/Results/ATIS-mysql_3.21-Linux_2.0.35_i686|19700101030959|02036|c25425e045ca8dfc BK|sql-bench/Results/ATIS-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02304|cbe120d860296d2f BK|sql-bench/Results/ATIS-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02027|a74e7b82d3908fa9 @@ -263,7 +265,9 @@ BK|sql-bench/Results/RUN-mysql-3.21-Linux_2.2.1_i686|19700101030959|02050|f6fdd6 BK|sql-bench/Results/RUN-mysql-Linux_2.2.10_i686|19700101030959|02041|712f52be5d195406 BK|sql-bench/Results/RUN-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02038|8ee87b26b91c86fe BK|sql-bench/Results/RUN-mysql-Linux_2.2.14_i686_xeon|19700101030959|02055|17854e751e1d9d1d +BK|sql-bench/Results/RUN-mysql-SunOS_5.5.1_sun4u|19700101030959|02058|afbba182428e20df BK|sql-bench/Results/RUN-mysql-SunOS_5.6_sun4m|19700101030959|02059|eafc8188345e262b +BK|sql-bench/Results/RUN-mysql-SunOS_5.7_sun4u|19700101030959|02061|86e1dc0e25a8b8f BK|sql-bench/Results/RUN-mysql_3.21-Linux_2.0.35_i686|19700101030959|02064|ea8672d8473435 BK|sql-bench/Results/RUN-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02310|a902e1a967d79c42 BK|sql-bench/Results/RUN-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02030|413ab3b8a99e61e9 @@ -273,7 +277,9 @@ BK|sql-bench/Results/alter-table-mysql-3.21-Linux_2.2.1_i686|19700101030959|0207 BK|sql-bench/Results/alter-table-mysql-Linux_2.2.10_i686|19700101030959|02081|93b78a85b720a186 BK|sql-bench/Results/alter-table-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02314|4ae4b989301df98b BK|sql-bench/Results/alter-table-mysql-Linux_2.2.14_i686_xeon|19700101030959|02057|64cc4b874cd6fabf +BK|sql-bench/Results/alter-table-mysql-SunOS_5.5.1_sun4u|19700101030959|02087|9d7e75667fcb29ec BK|sql-bench/Results/alter-table-mysql-SunOS_5.6_sun4m|19700101030959|02088|8a1bd6589a189890 +BK|sql-bench/Results/alter-table-mysql-SunOS_5.7_sun4u|19700101030959|02090|ce74c2f623d3bb3 BK|sql-bench/Results/alter-table-mysql_3.21-Linux_2.0.35_i686|19700101030959|02092|762639f2560976bd BK|sql-bench/Results/alter-table-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02316|1390155aad5b6e86 BK|sql-bench/Results/alter-table-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02317|9090bebb62ef164b @@ -283,7 +289,9 @@ BK|sql-bench/Results/big-tables-mysql-3.21-Linux_2.2.1_i686|19700101030959|02106 BK|sql-bench/Results/big-tables-mysql-Linux_2.2.10_i686|19700101030959|02109|99daa1c5370d077d BK|sql-bench/Results/big-tables-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02315|2804ec3c95be436a BK|sql-bench/Results/big-tables-mysql-Linux_2.2.14_i686_xeon|19700101030959|02074|290c2c3de9d8e6b +BK|sql-bench/Results/big-tables-mysql-SunOS_5.5.1_sun4u|19700101030959|02115|7d7b6c0bf58b9b79 BK|sql-bench/Results/big-tables-mysql-SunOS_5.6_sun4m|19700101030959|02116|f351a7f3e1e2257e +BK|sql-bench/Results/big-tables-mysql-SunOS_5.7_sun4u|19700101030959|02118|ebc379b231312bbe BK|sql-bench/Results/big-tables-mysql_3.21-Linux_2.0.35_i686|19700101030959|02120|190e827e569c99a4 BK|sql-bench/Results/big-tables-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02318|c5eabcb89ceac698 BK|sql-bench/Results/big-tables-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02319|856d503725373684 @@ -293,7 +301,9 @@ BK|sql-bench/Results/connect-mysql-3.21-Linux_2.2.1_i686|19700101030959|02134|c0 BK|sql-bench/Results/connect-mysql-Linux_2.2.10_i686|19700101030959|02137|c92505d77e19d5ec BK|sql-bench/Results/connect-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02084|e7e2959b7387251f BK|sql-bench/Results/connect-mysql-Linux_2.2.14_i686_xeon|19700101030959|02071|ea19dc3ec55b3618 +BK|sql-bench/Results/connect-mysql-SunOS_5.5.1_sun4u|19700101030959|02142|a9493110fe62e0b1 BK|sql-bench/Results/connect-mysql-SunOS_5.6_sun4m|19700101030959|02143|a10e3ddfa26a3e7f +BK|sql-bench/Results/connect-mysql-SunOS_5.7_sun4u|19700101030959|02145|c67beb9e9d2cf32e BK|sql-bench/Results/connect-mysql_3.21-Linux_2.0.35_i686|19700101030959|02146|650abd213e6828c6 BK|sql-bench/Results/connect-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02320|ce69cc65bc827b5c BK|sql-bench/Results/connect-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02066|f801e08429a4f7c6 @@ -303,7 +313,9 @@ BK|sql-bench/Results/create-mysql-3.21-Linux_2.2.1_i686|19700101030959|02158|515 BK|sql-bench/Results/create-mysql-Linux_2.2.10_i686|19700101030959|02161|9e7822f66df6aa76 BK|sql-bench/Results/create-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02102|34ded91c5fc25de9 BK|sql-bench/Results/create-mysql-Linux_2.2.14_i686_xeon|19700101030959|02139|50d15991293030ef +BK|sql-bench/Results/create-mysql-SunOS_5.5.1_sun4u|19700101030959|02166|bbb5de66fc56de7b BK|sql-bench/Results/create-mysql-SunOS_5.6_sun4m|19700101030959|02221|9233114ae6f8c5f +BK|sql-bench/Results/create-mysql-SunOS_5.7_sun4u|19700101030959|02223|7ee13bfcafeab498 BK|sql-bench/Results/create-mysql_3.21-Linux_2.0.35_i686|19700101030959|02225|df1b037d17b33587 BK|sql-bench/Results/create-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02321|e985e71d552ff09e BK|sql-bench/Results/create-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02099|483dcf223d5abf81 @@ -313,7 +325,9 @@ BK|sql-bench/Results/insert-mysql-3.21-Linux_2.2.1_i686|19700101030959|02239|fd0 BK|sql-bench/Results/insert-mysql-Linux_2.2.10_i686|19700101030959|02242|763edf9aec633f51 BK|sql-bench/Results/insert-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02130|5be3d6f299738a31 BK|sql-bench/Results/insert-mysql-Linux_2.2.14_i686_xeon|19700101030959|02141|c683ee4b9d214298 +BK|sql-bench/Results/insert-mysql-SunOS_5.5.1_sun4u|19700101030959|02247|8a9ae41f9a79f79 BK|sql-bench/Results/insert-mysql-SunOS_5.6_sun4m|19700101030959|02248|3402d060ae20e19 +BK|sql-bench/Results/insert-mysql-SunOS_5.7_sun4u|19700101030959|02250|78efa132c6e252b9 BK|sql-bench/Results/insert-mysql_3.21-Linux_2.0.35_i686|19700101030959|02252|60c0965dff31db07 BK|sql-bench/Results/insert-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02322|ed252140ff399961 BK|sql-bench/Results/insert-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02114|29a3b8a1ca8aa9d @@ -323,7 +337,9 @@ BK|sql-bench/Results/select-mysql-3.21-Linux_2.2.1_i686|19700101030959|02265|ed3 BK|sql-bench/Results/select-mysql-Linux_2.2.10_i686|19700101030959|02268|a2e264d777b787d BK|sql-bench/Results/select-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02227|308117295c3bc096 BK|sql-bench/Results/select-mysql-Linux_2.2.14_i686_xeon|19700101030959|02152|ead3f11b46ac626f +BK|sql-bench/Results/select-mysql-SunOS_5.5.1_sun4u|19700101030959|02273|c9a1a498a052e268 BK|sql-bench/Results/select-mysql-SunOS_5.6_sun4m|19700101030959|02274|4da215905bce988d +BK|sql-bench/Results/select-mysql-SunOS_5.7_sun4u|19700101030959|02276|632c92971c61e34a BK|sql-bench/Results/select-mysql_3.21-Linux_2.0.35_i686|19700101030959|02278|5fadbac5f98696a BK|sql-bench/Results/select-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02323|e8c0871a668a610d BK|sql-bench/Results/select-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02127|963a98ed526e2be4 @@ -333,7 +349,9 @@ BK|sql-bench/Results/wisconsin-mysql-3.21-Linux_2.2.1_i686|19700101030959|02290| BK|sql-bench/Results/wisconsin-mysql-Linux_2.2.10_i686|19700101030959|02288|301a82b12a84922b BK|sql-bench/Results/wisconsin-mysql-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02280|d01900af34fb33b8 BK|sql-bench/Results/wisconsin-mysql-Linux_2.2.14_i686_xeon|19700101030959|02154|7525b23938631801 +BK|sql-bench/Results/wisconsin-mysql-SunOS_5.5.1_sun4u|19700101030959|02297|379705afa2e12378 BK|sql-bench/Results/wisconsin-mysql-SunOS_5.6_sun4m|19700101030959|02298|ec61b14072715dc8 +BK|sql-bench/Results/wisconsin-mysql-SunOS_5.7_sun4u|19700101030959|02300|f27927f8c64ea8ad BK|sql-bench/Results/wisconsin-mysql_3.21-Linux_2.0.35_i686|19700101030959|02302|31703d40ea6b4f66 BK|sql-bench/Results/wisconsin-mysql_fast-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02324|ec075a89dbdbbe6a BK|sql-bench/Results/wisconsin-pg-Linux_2.2.14_5.0_i686-cmp-mysql,pg|19700101030959|02325|233d5aa529979990 @@ -652,6 +670,7 @@ mwagner@evoq.home.mwagner.org|Docs/Books/prof.eps|20001231203220|15779|dc69b0395 mwagner@evoq.home.mwagner.org|Docs/Books/pthreads.eps|20001231203220|18899|d60ad51891ef4c49 mwagner@evoq.home.mwagner.org|Docs/Books/realmen.eps|20001231203220|22075|1ceb4839e835dad4 mwagner@evoq.home.mwagner.org|Docs/Books/sql-99.eps|20001231203220|25230|cec4ae16fee4c640 +mwagner@evoq.home.mwagner.org|mysql-test/chew_on_this/select.res|20001014084759|41327|1295456b9394876 mwagner@evoq.home.mwagner.org|mysql-test/chew_on_this/select.res|20001014084759|41327|1295456b93948768 mwagner@evoq.home.mwagner.org|mysql-test/chew_on_this/select.tst|20001013104933|54568|2e626fa07144d2c8 mwagner@evoq.home.mwagner.org|mysql-test/mybin/start-mysqld|20001016055648|54840|9c8f21a7ab97793a @@ -726,6 +745,8 @@ mwagner@evoq.home.mwagner.org|mysql-test/xml/tests/sel000029.xml|20001017133713| mwagner@evoq.home.mwagner.org|mysql-test/xml/tests/sel000030.xml|20001017133600|63205|c2b25781eefaee9 mwagner@evoq.home.mwagner.org|mysql-test/xml/xsl/README|20001013051514|26509|cd4bb681e5a0cd10 mwagner@evoq.home.mwagner.org|mysql-test/xml/xsl/mysqltest.xsl|20001013051514|27425|1b8f6ec4f1b5f634 +mwagner@work.mysql.com|mysql-test/r/3.23/sel000001.result|20001010091454|28284|383913ae4505ec86 +mwagner@work.mysql.com|mysql-test/r/3.23/sel000002.result|20001010091454|29230|d1787e6fd5dbc1cc nick@nick.leippe.com|mysql-test/r/rpl_empty_master_crash.result|20020531235552|47718|615f521be2132141 nick@nick.leippe.com|mysql-test/t/rpl_empty_master_crash.test|20020531235552|52328|99464e737639ccc6 sasha@mysql.sashanet.com|BitKeeper/etc/logging_ok|20000801000905|12967|5b7d847a2158554 @@ -733,19 +754,36 @@ sasha@mysql.sashanet.com|build-tags|20011125054855|05181|7afb7e785b80f97 sasha@mysql.sashanet.com|build-tags|20011201050944|25384|b6f6fff142121618 sasha@mysql.sashanet.com|libmysql_r/acconfig.h|20001128060846|51084|65f1202b3b5c345f sasha@mysql.sashanet.com|mysql-test/README.gcov|20001012045950|28177|5a6da067a30780ce +sasha@mysql.sashanet.com|mysql-test/README.gcov|20001214012355|41825|2de7575ca81155e5 sasha@mysql.sashanet.com|mysql-test/README|20001010001022|12739|108667adaeabe3f5 sasha@mysql.sashanet.com|mysql-test/r/3.23/alt000001.result|20001122072330|24729|393103dbf15f35c9 +sasha@mysql.sashanet.com|mysql-test/r/3.23/ins000001.result|20001018175743|49824|f45c599efdf8352b sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000001.a.result|20001118063528|39426|2987b17db06808c3 sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000001.b.result|20001118063528|44057|62e1fa91167cacc3 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000002.result|20001118063528|46039|109f5ceed1e0d64 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000003.result|20001118063528|48148|68d6ee00beaa011 sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000004.a.result|20001118063528|50132|3415f066cb91c460 sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000004.b.result|20001118063528|52094|352b35351551485 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000005.result|20001118063528|54071|a50962bc2340ab9a +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000006.result|20001118063528|56081|5653051e8ce6b4aa +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000007.result|20001121063807|21606|e0c3b6134e0884da +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000008.result|20001121063807|23636|c5cfee19ca5a7da9 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000009.result|20001121063807|25633|ed8042446ab97926 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000010.result|20001122072330|29430|3228109b8965b0f8 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000011.result|20001125024912|48851|c29dce30aa97f265 +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000012.result|20001126062901|05938|35d6596da7b90fc5 sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000012.status.result|20001126062901|09395|bbbd650b5beea32f +sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000013.result|20001202171150|03876|ac5024e6cf6daac6 sasha@mysql.sashanet.com|mysql-test/r/3.23/rpl000013.status.result|20001202171150|06069|6bee190c298cc9fd +sasha@mysql.sashanet.com|mysql-test/r/3.23/sel000003.result|20001011230020|64653|d7b657b1e3a286a7 +sasha@mysql.sashanet.com|mysql-test/r/3.23/sel000100.res|20001205131218|23520|84ed46856cb3a69f sasha@mysql.sashanet.com|mysql-test/r/3.23/shw000001.result|20001121234128|16652|8b20b03d8319b9a5 sasha@mysql.sashanet.com|mysql-test/r/binlog-backup-restore.result|20010424233926|16010|605de78abda64d27 sasha@mysql.sashanet.com|mysql-test/r/df_crash.result|20010406010433|59989|4a3dbee64843953d sasha@mysql.sashanet.com|mysql-test/r/identity.result|20010910233028|16331|e41453a364242503 sasha@mysql.sashanet.com|mysql-test/r/mrg000002.result|20001212152450|11492|745be0854aaaaf5e +sasha@mysql.sashanet.com|mysql-test/r/slave-running.result|20001208141122|24303|f73e49462cf59e1f +sasha@mysql.sashanet.com|mysql-test/r/slave-stopped.result|20001208141122|28916|25c134b1a4f1993a sasha@mysql.sashanet.com|mysql-test/std_data/m.MRG|20001212152450|17736|3f5632c37af00f18 sasha@mysql.sashanet.com|mysql-test/std_data/m.frm|20001212152450|13897|e351dfe0b6824c0c sasha@mysql.sashanet.com|mysql-test/std_data/select-key.master|20001009234916|07315|e6b83af25df0ce5 diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5f7bbf0e9ee..aec1275d516 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -20,6 +20,7 @@ heikki@donna.mysql.fi heikki@hundin.mysql.fi heikki@rescue. heikki@work.mysql.com +hf@genie.(none) jani@dsl-jkl1657.dial.inet.fi jani@hynda.(none) jani@hynda.mysql.fi diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 9f62b617056..a29bd99191d 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -215,7 +215,14 @@ if ($opt_stage <= 1) # Only enable InnoDB when requested (required to be able to # build the "Classic" packages that do not include InnoDB) - $opt_config_options.= " --without-innodb" if (!$opt_innodb); + if ($opt_innodb) + { + $opt_config_options.= " --with-innodb"; + } + else + { + $opt_config_options.= " --without-innodb"; + } if ($opt_with_other_libc) { @@ -314,7 +321,7 @@ if (!$opt_no_test) } if ($opt_innodb) { - $extra.=" --innodb_data_file_path=ibdata1:100M"; + $extra.=" --innodb_data_file_path=ibdata1:100M:autoextend"; } safe_system("./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-locking $extra >> $log 2>&1 &"); sleep(2); diff --git a/Docs/manual.texi b/Docs/manual.texi index c53bd24ac86..c39da1e37d1 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -9934,7 +9934,9 @@ Error in accept: Protocol error @end example You might try starting the server with the @code{--set-variable back_log=50} -option as a workaround for this. @xref{Command-line options}. +option as a workaround for this. Please note that @code{--set-variable} is +deprecated since @strong{MySQL 4.0}, just use @code{--back_log=50} instead. +@xref{Command-line options}. If you are linking your own MySQL client, you might get the following error when you try to execute it: @@ -14390,7 +14392,9 @@ Only use one thread (for debugging under Linux). @xref{Debugging server}. Give a variable a value. @code{--help} lists variables. You can find a full description for all variables in the @code{SHOW VARIABLES} section in this manual. @xref{SHOW VARIABLES}. The tuning server parameters section includes -information of how to optimise these. @xref{Server parameters}. +information of how to optimize these. Please note that @code{--set-variable} +is deprecated since @strong{MySQL 4.0}, just use @code{--var=option} instead. +@xref{Server parameters}. In MySQL 4.0.2 one can set a variable directly with @code{--variable-name=option} and @code{set-variable} is not anymore needed @@ -14611,7 +14615,9 @@ This is equivalent to @code{--option=value} on the command-line. @item set-variable = variable=value This is equivalent to @code{--set-variable variable=value} on the command-line. -This syntax must be used to set a @code{mysqld} variable. +This syntax must be used to set a @code{mysqld} variable. Please note that +@code{--set-variable} is deprecated since @strong{MySQL 4.0}, just use +@code{--variable=value} instead. @end table The @code{client} group allows you to specify options that apply to all @@ -18164,8 +18170,10 @@ Output debug log. The @code{debug_options} string often is @item -? or --help Display a help message and exit. @item -O var=option, --set-variable var=option -Set the value of a variable. The possible variables and their default values -for myisamchk can be examined with @code{myisamchk --help}: +Set the value of a variable. Please note that @code{--set-variable} is +deprecated since @strong{MySQL 4.0}, just use @code{--var=option} instead. +The possible variables and their default values for myisamchk can be examined +with @code{myisamchk --help}: @multitable @columnfractions .20 .10 @item @strong{Variable} @tab @strong{Value} @item key_buffer_size @tab 523264 @@ -22104,6 +22112,8 @@ Don't write column names in results. @cindex @code{set-variable}, @code{mysql} option @item -O, --set-variable var=option Give a variable a value. @code{--help} lists variables. +Please note that @code{--set-variable} is deprecated since +@strong{MySQL 4.0}, just use @code{--var=option} instead. @cindex @code{one-database}, @code{mysql} option @item -o, --one-database @@ -22181,7 +22191,8 @@ Wait and retry if connection is down instead of aborting. @end table You can also set the following variables with @code{-O} or -@code{--set-variable}: +@code{--set-variable}; please note that @code{--set-variable} is +deprecated since @strong{MySQL 4.0}, just use @code{--var=option} instead: @cindex timeout, @code{connect_timeout} variable @cindex @code{connect_timeout} variable @@ -22874,6 +22885,8 @@ The MySQL user name to use when connecting to the server. The default value is your Unix login name. @item -O var=option, --set-variable var=option Set the value of a variable. The possible variables are listed below. +Please note that @code{--set-variable} is deprecated since +@strong{MySQL 4.0}, just use @code{--var=option} instead. @item -v, --verbose Verbose mode. Print out more information on what the program does. @item -V, --version @@ -27396,6 +27409,9 @@ thread_stack current value: 131072 wait_timeout current value: 28800 @end example +Please note that @code{--set-variable} is deprecated since +@strong{MySQL 4.0}, just use @code{--var=option} instead. + If there is a @code{mysqld} server currently running, you can see what values it actually is using for the variables by executing this command: @@ -45679,7 +45695,7 @@ will be active. static char *server_args[] = @{ "this_program", /* this string is not used */ "--datadir=.", - "--set-variable=key_buffer_size=32M" + "--key_buffer_size=32M" @}; static char *server_groups[] = @{ "embedded", @@ -47995,6 +48011,8 @@ use big packets so that you run out of memory. If you are using the @code{mysql} client, you may specify a bigger buffer by starting the client with @code{mysql --set-variable=max_allowed_packet=8M}. Other clients have different methods to set this variable. +Please note that @code{--set-variable} is deprecated since +@strong{MySQL 4.0}, just use @code{--max-allowed-packet=8M} instead. You can use the option file to set @code{max_allowed_packet} to a larger size in @code{mysqld}. For example, if you are expecting to store the @@ -50797,6 +50815,8 @@ each individual 4.0.x release. @appendixsubsec Changes in release 4.0.5 @itemize @item +Small code improvement in multi-table updates +@item Fixed a newly introduced bug that caused @code{ORDER BY ... LIMIT #} to not return all rows. @item @@ -50826,6 +50846,12 @@ original @code{--ignore-spaces} in @code{mysqlclient}. (Both syntaxes will work). @item Don't require @code{UPDATE} privilege when using @code{REPLACE}. +@item +Allow braces in joins in all positions. Formerly, things like +@code{SELECT * FROM (t2 LEFT JOIN t3 USING (a)), t1} worked, but +not @code{SELECT * FROM t1, (t2 LEFT JOIN t3 USING (a))}. Note that +braces are simply removed, they do not change the way the join is +executed. @end itemize @node News-4.0.4, News-4.0.3, News-4.0.5, News-4.0.x @@ -51654,6 +51680,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.54 @itemize @item +Fixed a problem with BDB and @code{ALTER TABLE}. +@item Fixed reference to freed memory when doing complicated @code{GROUP BY ... ORDER BY} queries. Symptom was that @code{mysqld} died in function @code{send_fields}. @@ -51689,8 +51717,6 @@ Small fix in @code{safe_mysqld} for some shells. @item Fixed that @code{FLUSH STATUS} doesn't reset @code{Delayed_insert_threads}. @item -Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}. -@item Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value. @item Fixed race condition when someone did a @code{GRANT} at the same time a new diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 394555f37a9..24b67a60255 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -16,7 +16,7 @@ /* By Jani Tolonen, 2001-04-20, MySQL Development Team */ -#define CHECK_VERSION "2.4.1" +#define CHECK_VERSION "2.4.2" #include "client_priv.h" #include <m_ctype.h> @@ -463,7 +463,7 @@ static int handle_request_for_tables(char *tables, uint length) if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) return 1; - sprintf(query, "%s TABLE `%s` %s", op, tables, options); + sprintf(query, "%s TABLE %s %s", op, tables, options); if (mysql_query(sock, query)) { sprintf(message, "when executing '%s TABLE `%s` %s", op, tables,options); @@ -493,12 +493,9 @@ static void print_result() if (status) { - if (found_error) - { - if (what_to_do != DO_REPAIR && opt_auto_repair && - (!opt_fast || strcmp(row[3],"OK"))) - insert_dynamic(&tables4repair, row[0]); - } + if (found_error && opt_auto_repair && what_to_do != DO_REPAIR && + (!opt_fast || strcmp(row[3],"OK"))) + insert_dynamic(&tables4repair, prev); found_error=0; if (opt_silent) continue; @@ -515,6 +512,9 @@ static void print_result() strmov(prev, row[0]); putchar('\n'); } + if (found_error && opt_auto_repair && what_to_do != DO_REPAIR && + (!opt_fast || strcmp(row[3],"OK"))) + insert_dynamic(&tables4repair, prev); mysql_free_result(res); } diff --git a/include/my_base.h b/include/my_base.h index 0158f735cc0..7e1df17b69d 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -50,13 +50,14 @@ /* The following is parameter to ha_rkey() how to use key */ enum ha_rkey_function { - HA_READ_KEY_EXACT, /* Find first record else error */ - HA_READ_KEY_OR_NEXT, /* Record or next record */ - HA_READ_KEY_OR_PREV, /* Record or previous */ - HA_READ_AFTER_KEY, /* Find next rec. after key-record */ - HA_READ_BEFORE_KEY, /* Find next rec. before key-record */ - HA_READ_PREFIX, /* Key which as same prefix */ - HA_READ_PREFIX_LAST, /* Last key with the same prefix */ + HA_READ_KEY_EXACT, /* Find first record else error */ + HA_READ_KEY_OR_NEXT, /* Record or next record */ + HA_READ_KEY_OR_PREV, /* Record or previous */ + HA_READ_AFTER_KEY, /* Find next rec. after key-record */ + HA_READ_BEFORE_KEY, /* Find next rec. before key-record */ + HA_READ_PREFIX, /* Key which as same prefix */ + HA_READ_PREFIX_LAST, /* Last key with the same prefix */ + HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */ HA_READ_MBR_CONTAIN, HA_READ_MBR_INTERSECT, HA_READ_MBR_WITHIN, @@ -66,7 +67,7 @@ enum ha_rkey_function { /* Key algorithm types */ -enum ha_key_alg { +enum ha_key_alg { HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */ HA_KEY_ALG_BTREE= 1, /* B-tree, default one */ HA_KEY_ALG_RTREE= 2, /* R-tree, for spatial searches */ @@ -202,7 +203,7 @@ enum ha_base_keytype { /* Bits in flag to _status */ #define HA_STATUS_POS 1 /* Return position */ -#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */ +#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */ #define HA_STATUS_TIME 4 /* Return update time */ #define HA_STATUS_CONST 8 /* Return constants values */ #define HA_STATUS_VARIABLE 16 @@ -233,7 +234,7 @@ enum ha_base_keytype { #define HA_ERR_WRONG_TABLE_DEF 143 #define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ #define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ -#define HA_ERR_LOCK_WAIT_TIMEOUT 146 +#define HA_ERR_LOCK_WAIT_TIMEOUT 146 #define HA_ERR_LOCK_TABLE_FULL 147 #define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */ #define HA_ERR_LOCK_DEADLOCK 149 @@ -272,7 +273,7 @@ enum ha_base_keytype { #define READ_CHECK_USED 4 #define KEY_READ_USED 8 #define WRITE_CACHE_USED 16 -#define OPT_NO_ROWS 32 +#define OPT_NO_ROWS 32 /* bits in update */ #define HA_STATE_CHANGED 1 /* Database has changed */ @@ -302,7 +303,7 @@ enum data_file_type { #ifdef BIG_TABLES typedef my_off_t ha_rows; #else -typedef ulong ha_rows; +typedef ulong ha_rows; #endif #define HA_POS_ERROR (~ (ha_rows) 0) diff --git a/include/mysql_com.h b/include/mysql_com.h index bc273750e3a..45dcd3c99f7 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -51,7 +51,7 @@ enum enum_server_command #define BLOB_FLAG 16 /* Field is a blob */ #define UNSIGNED_FLAG 32 /* Field is unsigned */ #define ZEROFILL_FLAG 64 /* Field is zerofill */ -#define BINARY_FLAG 128 + /* The following are only sent to new clients */ #define ENUM_FLAG 256 /* field is an enum */ #define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ diff --git a/innobase/pars/lexyy.c b/innobase/pars/lexyy.c index f7edc9d195f..782fca35f66 100644 --- a/innobase/pars/lexyy.c +++ b/innobase/pars/lexyy.c @@ -4,6 +4,8 @@ * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ +#include "univ.i" + #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 @@ -607,13 +609,18 @@ How to make the InnoDB parser and lexer C files: 6. Remove the #include of unistd.h from about line 2500 of lexyy.c +7. Move #include <math.h> in pars0grm.c after #include "univ.i" to remove + a large file compilation error on AIX. + +8. Move #include "univ.i" in lexyy.c to the file start to remove a large + file compilation error on AIX. + These instructions seem to work at least with bison-1.28 and flex-2.5.4 on Linux. *******************************************************/ #line 36 "pars0lex.l" #define YYSTYPE que_node_t* -#include "univ.i" #include "pars0pars.h" #include "pars0grm.h" #include "pars0sym.h" diff --git a/innobase/pars/pars0grm.c b/innobase/pars/pars0grm.c index 05b75398084..ce575063610 100644 --- a/innobase/pars/pars0grm.c +++ b/innobase/pars/pars0grm.c @@ -102,6 +102,8 @@ que_node_t */ #include "que0que.h" #include "row0sel.h" +#include <math.h> + #define YYSTYPE que_node_t* /* #define __STDC__ */ diff --git a/isam/_search.c b/isam/_search.c index 445340a21d6..d5e145ae0bf 100644 --- a/isam/_search.c +++ b/isam/_search.c @@ -118,7 +118,7 @@ int _nisam_search(register N_INFO *info, register N_KEYDEF *keyinfo, uchar *key, if ((nextflag & (SEARCH_SMALLER | SEARCH_LAST)) && flag != 0) { keypos=_nisam_get_last_key(info,keyinfo,buff,lastkey,keypos); - if ((nextflag & SEARCH_LAST) && + if (!(nextflag & SEARCH_SMALLER) && _nisam_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND)) { my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */ diff --git a/isam/static.c b/isam/static.c index 9c68a0cfdba..0a8dc809ad7 100644 --- a/isam/static.c +++ b/isam/static.c @@ -41,5 +41,5 @@ uint NEAR nisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, - SEARCH_FIND, SEARCH_LAST + SEARCH_FIND, SEARCH_LAST,SEARCH_LAST | SEARCH_SMALLER }; diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 42ad0021542..09681fa3a63 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -107,6 +107,7 @@ void start_embedded_conn1(NET * net) thd->command=COM_SLEEP; thd->version=refresh_version; thd->set_time(); + bzero(thd->scramble, sizeof(thd->scramble)); init_sql_alloc(&thd->mem_root,8192,8192); check_connections1(thd); diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index fadffc0535e..2b9b6cedcf6 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -202,7 +202,8 @@ static void _ftb_init_index_search(FT_INFO *ftb) MI_KEYDEF *keyinfo; my_off_t keyroot; - if (ftb->state != READY || ftb->keynr == NO_SUCH_KEY) + if ((ftb->state != READY && ftb->state !=INDEX_DONE) || + ftb->keynr == NO_SUCH_KEY) return; ftb->state=INDEX_SEARCH; diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index f3fa8865bc6..7225896c69e 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -79,6 +79,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) #error #endif + DBUG_ENTER("walk_and_match"); + word->weight=LWS_FOR_QUERY; keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0); @@ -112,7 +114,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) #else #error #endif - if(tmp_weight==0) return doc_cnt; /* stopword, doc_cnt should be 0 */ + if(tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */ #ifdef EVAL_RUN cnt=*(byte *)(aio->info->lastkey+keylen); @@ -122,7 +124,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) /* saving document matched into dtree */ if (!(selem=tree_insert(&aio->dtree, &sdoc, 0, aio->dtree.custom_arg))) - return 1; + DBUG_RETURN(1); sptr=(FT_SUPERDOC *)ELEMENT_KEY((&aio->dtree), selem); @@ -153,21 +155,22 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) if (doc_cnt) { word->weight*=GWS_IN_USE; - if (word->weight < 0) - word->weight=0; + if (word->weight < 0) word->weight=0; + } - return 0; + DBUG_RETURN(0); } static int walk_and_copy(FT_SUPERDOC *from, uint32 count __attribute__((unused)), FT_DOC **to) { + DBUG_ENTER("walk_and_copy"); from->doc.weight+=from->tmp_weight*from->word_ptr->weight; (*to)->dpos=from->doc.dpos; (*to)->weight=from->doc.weight; (*to)++; - return 0; + DBUG_RETURN(0); } @@ -185,12 +188,13 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, FT_DOC *dptr; FT_INFO *dlist=NULL; my_off_t saved_lastpos=info->lastpos; + DBUG_ENTER("ft_init_nlq_search"); /* black magic ON */ if ((int) (keynr = _mi_check_index(info,keynr)) < 0) - return NULL; + DBUG_RETURN(NULL); if (_mi_readinfo(info,F_RDLCK,1)) - return NULL; + DBUG_RETURN(NULL); /* black magic OFF */ aio.info=info; @@ -237,7 +241,7 @@ err2: err: info->lastpos=saved_lastpos; - return dlist; + DBUG_RETURN(dlist); } diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c index 583518089ba..29a48352cd6 100644 --- a/myisam/ft_parser.c +++ b/myisam/ft_parser.c @@ -190,6 +190,7 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word) { byte *doc=*start; int mwc; + DBUG_ENTER("ft_simple_get_word"); while (doc<end) { @@ -211,32 +212,35 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word) !is_stopword(word->pos, word->len)) { *start=doc; - return 1; + DBUG_RETURN(1); } } - return 0; + DBUG_RETURN(0); } void ft_parse_init(TREE *wtree, CHARSET_INFO *cs) { + DBUG_ENTER("ft_parse_init"); if (!is_tree_inited(wtree)) init_tree(wtree,0,0,sizeof(FT_WORD),(qsort_cmp2)&FT_WORD_cmp,0,NULL, cs); + DBUG_VOID_RETURN; } int ft_parse(TREE *wtree, byte *doc, int doclen) { byte *end=doc+doclen; FT_WORD w; + DBUG_ENTER("ft_parse"); while (ft_simple_get_word(&doc,end,&w)) { if (!tree_insert(wtree, &w, 0, wtree->custom_arg)) goto err; } - return 0; + DBUG_RETURN(0); err: delete_tree(wtree); - return 1; + DBUG_RETURN(1); } diff --git a/myisam/ftdefs.h b/myisam/ftdefs.h index 22a81ca4f9c..592b60a0133 100644 --- a/myisam/ftdefs.h +++ b/myisam/ftdefs.h @@ -78,7 +78,7 @@ extern ulong collstat; /* Mysterious, but w/o (double) GWS_IDF performs better :-o */ #define GWS_IDF log(aio->info->state->records/doc_cnt) #define GWS_IDF1 log((double)aio->info->state->records/doc_cnt) -#define GWS_PROB log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) +#define GWS_PROB ((aio->info->state->records > doc_cnt) ? log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) : 0 ) #define GWS_FREQ (1.0/doc_cnt) #define GWS_SQUARED pow(log((double)aio->info->state->records/doc_cnt),2) #define GWS_CUBIC pow(log((double)aio->info->state->records/doc_cnt),3) diff --git a/myisam/mi_create.c b/myisam/mi_create.c index 0fe983bf115..8087d17904a 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -404,7 +404,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, length+=key_length; keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE); if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH || - length > MI_MAX_KEY_LENGTH) + length >= MI_MAX_KEY_BUFF) { my_errno=HA_WRONG_CREATE_OPTION; goto err; diff --git a/myisam/mi_delete_all.c b/myisam/mi_delete_all.c index 7e4239bc7d1..45e56626d59 100644 --- a/myisam/mi_delete_all.c +++ b/myisam/mi_delete_all.c @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Remove all rows from a MyISAM table */ -/* This only clears the status information and truncates the data file */ +/* This clears the status information and truncates files */ #include "myisamdef.h" @@ -49,14 +49,15 @@ int mi_delete_all_rows(MI_INFO *info) state->key_root[i]= HA_OFFSET_ERROR; myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0); - VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); - if (my_chsize(info->dfile, 0, 0, MYF(MY_WME))) - goto err; /* If we are using delayed keys or if the user has done changes to the tables since it was locked then there may be key blocks in the key cache */ flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED); + if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) || + my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) ) + goto err; + VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); allow_break(); /* Allow SIGHUP & SIGINT */ DBUG_RETURN(0); diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 737bb2fd5d3..8aeccbbf559 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -132,7 +132,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (_mi_get_prev_key(info,keyinfo, buff, info->lastkey, keypos, &info->lastkey_length)) goto err; - if ((nextflag & SEARCH_LAST) && + if (!(nextflag & SEARCH_SMALLER) && ha_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND, ¬_used)) { diff --git a/myisam/mi_static.c b/myisam/mi_static.c index 57683a36920..a36c38e3c01 100644 --- a/myisam/mi_static.c +++ b/myisam/mi_static.c @@ -51,12 +51,12 @@ uint NEAR myisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, - SEARCH_FIND | SEARCH_PREFIX, SEARCH_LAST, + SEARCH_FIND | SEARCH_PREFIX, SEARCH_LAST, SEARCH_LAST | SEARCH_SMALLER, MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL }; uint NEAR myisam_readnext_vec[]= { SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, - SEARCH_BIGGER, SEARCH_SMALLER + SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER }; diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 474b1357e9e..1013cd2cd52 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -4,7 +4,7 @@ connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); connection slave; --error 0,1199 -!slave stop; +!stop slave; @r/slave-stopped.result show status like 'Slave_running'; connection master; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; @@ -13,7 +13,7 @@ connection slave; reset slave; # Clean up old test tables drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; @r/slave-running.result show status like 'Slave_running'; # Set the default connection to 'master' diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 3107737ca45..cf9b6653c5a 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -192,6 +192,7 @@ CHARACTER_SET=latin1 DBUSER="" START_WAIT_TIMEOUT=10 STOP_WAIT_TIMEOUT=10 +TEST_REPLICATION=0 while test $# -gt 0; do case "$1" in @@ -265,6 +266,9 @@ while test $# -gt 0; do --user-test=*) USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"` ;; + --rpl) + TEST_REPLICATION=1 + ;; --mysqld=*) TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"` EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP" @@ -1289,15 +1293,22 @@ $ECHO $DASH72 if [ -z "$1" ] ; then - if [ x$RECORD = x1 ]; then - $ECHO "Will not run in record mode without a specific test case." - else - for tf in $TESTDIR/*.$TESTSUFFIX - do - run_testcase $tf - done - $RM -f $TIMEFILE # Remove for full test - fi + if [ x$RECORD = x1 ]; then + $ECHO "Will not run in record mode without a specific test case." + else + if [ x$TEST_REPLICATION = x1 ]; then + for tf in $TESTDIR/rpl*.$TESTSUFFIX + do + run_testcase $tf + done + else + for tf in $TESTDIR/*.$TESTSUFFIX + do + run_testcase $tf + done + fi + $RM -f $TIMEFILE # Remove for full test + fi else while [ ! -z "$1" ]; do tname=`$BASENAME $1 .test` diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index b10738a9505..a3663416bc8 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -193,7 +193,7 @@ INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j' ('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'); select count(*) from t1 where upper(art) = 'J'; count(*) -602 +213 select count(*) from t1 where art = 'J' or art = 'j'; count(*) 602 diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result index 2dc21e86152..5cee2e6deff 100644 --- a/mysql-test/r/rpl000001.result +++ b/mysql-test/r/rpl000001.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1,t2,t3; create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; @@ -30,9 +30,9 @@ abandoned abandoning abandonment abandons -slave stop; +stop slave; set password for root@"localhost" = password('foo'); -slave start; +start slave; set password for root@"localhost" = password(''); create table t3(n int); insert into t3 values(1),(2); @@ -45,13 +45,13 @@ sum(length(word)) 141 drop table t1,t3; reset master; -slave stop; +stop slave; reset slave; create table t1(n int); select get_lock("hold_slave",10); get_lock("hold_slave",10) 1 -slave start; +start slave; select release_lock("hold_slave"); release_lock("hold_slave") 1 @@ -68,7 +68,7 @@ kill @id; drop table t2; Server shutdown in progress set global sql_slave_skip_counter=1; -slave start; +start slave; select count(*) from t1; count(*) 5000 diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result index 4c2b3bdfde6..819f43da103 100644 --- a/mysql-test/r/rpl000002.result +++ b/mysql-test/r/rpl000002.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1; create table t1 (n int auto_increment primary key); set insert_id = 2000; @@ -17,7 +17,7 @@ show slave hosts; Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 9999 2 1 drop table t1; -slave stop; +stop slave; drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; @@ -25,7 +25,7 @@ insert into t2 set created=now(); select * from t2; id created 1 1970-01-01 06:25:45 -slave start; +start slave; select * from t2; id created 1 1970-01-01 06:25:45 diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result index b123b3d98c5..7c63ada9cdf 100644 --- a/mysql-test/r/rpl000003.result +++ b/mysql-test/r/rpl000003.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1; create table t1(n int primary key); insert into t1 values (1),(2),(2); diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result index 82b208d0b58..a677eac36d4 100644 --- a/mysql-test/r/rpl000004.result +++ b/mysql-test/r/rpl000004.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; set SQL_LOG_BIN=0; drop table if exists t1; create table t1 (word char(20) not null, index(word)); diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result index 3e9028bf2cf..228bb00a1a3 100644 --- a/mysql-test/r/rpl000005.result +++ b/mysql-test/r/rpl000005.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1; CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result index e7fc5151ac4..e256e0f0136 100644 --- a/mysql-test/r/rpl000006.result +++ b/mysql-test/r/rpl000006.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; set SQL_LOG_BIN=0,timestamp=200006; drop table if exists t1; create table t1(t timestamp not null,a char(1)); diff --git a/mysql-test/r/rpl000007.result b/mysql-test/r/rpl000007.result index c2823bf1203..6889f6af2bc 100644 --- a/mysql-test/r/rpl000007.result +++ b/mysql-test/r/rpl000007.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists foo; create table foo (n int); insert into foo values(4); diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result index a0230d55702..eb0089da9d6 100644 --- a/mysql-test/r/rpl000008.result +++ b/mysql-test/r/rpl000008.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; use test; drop table if exists foo; create table foo (n int); diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result index afd566c366c..1a1ea309ae9 100644 --- a/mysql-test/r/rpl000009.result +++ b/mysql-test/r/rpl000009.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop database if exists foo; create database foo; drop database if exists bar; diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result index 49538ed148e..6b6b89d1547 100644 --- a/mysql-test/r/rpl000010.result +++ b/mysql-test/r/rpl000010.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1; drop table if exists t1; create table t1 (n int not null auto_increment primary key); diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result index 5d22c29bdba..bb017076822 100644 --- a/mysql-test/r/rpl000011.result +++ b/mysql-test/r/rpl000011.result @@ -1,14 +1,14 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1; create table t1 (n int); insert into t1 values(1); -slave stop; -slave start; +stop slave; +start slave; insert into t1 values(2); select * from t1; n diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result index 45de6502bbd..f809fa7fe74 100644 --- a/mysql-test/r/rpl000012.result +++ b/mysql-test/r/rpl000012.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result index 9e802da59c5..333d769baff 100644 --- a/mysql-test/r/rpl000013.result +++ b/mysql-test/r/rpl000013.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t2; create table t2(n int); create temporary table t1 (n int); diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result index 7010349e5ff..78cc007c1f9 100644 --- a/mysql-test/r/rpl000015.result +++ b/mysql-test/r/rpl000015.result @@ -14,7 +14,7 @@ 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 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.001 4 No No 0 0 0 4 -slave start; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 7 master-bin.001 79 slave-relay-bin.001 120 master-bin.001 Yes Yes 0 0 79 120 diff --git a/mysql-test/r/rpl000017.result b/mysql-test/r/rpl000017.result index bac0573165d..64e13042e9c 100644 --- a/mysql-test/r/rpl000017.result +++ b/mysql-test/r/rpl000017.result @@ -1,7 +1,7 @@ reset master; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; -slave start; +start slave; drop table if exists t1; create table t1(n int); insert into t1 values(24); diff --git a/mysql-test/r/rpl000018.result b/mysql-test/r/rpl000018.result index ba51406bba0..cb93993a6b3 100644 --- a/mysql-test/r/rpl000018.result +++ b/mysql-test/r/rpl000018.result @@ -1,6 +1,6 @@ reset slave; -slave start; -show master logs; +start slave; +show binary logs; Log_name master-bin.001 master-bin.002 diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result index 1dc73c6524a..0b947c0bb70 100644 --- a/mysql-test/r/rpl_alter.result +++ b/mysql-test/r/rpl_alter.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop database if exists d1; create database d1; create table d1.t1 ( n int); diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result index 19e2bf28dcd..267806feb2e 100644 --- a/mysql-test/r/rpl_empty_master_crash.result +++ b/mysql-test/r/rpl_empty_master_crash.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists 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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result index 14b749fada9..d122b13adc2 100644 --- a/mysql-test/r/rpl_failsafe.result +++ b/mysql-test/r/rpl_failsafe.result @@ -1,8 +1,8 @@ -slave stop; +stop slave; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 1 @@ -17,14 +17,14 @@ rpl_recovery_rank 2 show status like 'Rpl_status'; Variable_name Value Rpl_status ACTIVE_SLAVE -slave start; +start slave; show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 3 show status like 'Rpl_status'; Variable_name Value Rpl_status ACTIVE_SLAVE -slave start; +start slave; show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 4 diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result index da2930f30c3..a6c5ce02f4d 100644 --- a/mysql-test/r/rpl_flush_log_loop.result +++ b/mysql-test/r/rpl_flush_log_loop.result @@ -1,16 +1,16 @@ -slave stop; +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; -slave start; +start slave; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; -slave start; -slave stop; +start slave; +stop slave; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=SLAVE_PORT; -slave start; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space diff --git a/mysql-test/r/rpl_get_lock.result b/mysql-test/r/rpl_get_lock.result index a8e602be03f..369fde7ef8f 100644 --- a/mysql-test/r/rpl_get_lock.result +++ b/mysql-test/r/rpl_get_lock.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; create table t1(n int); insert into t1 values(get_lock("lock",2)); select get_lock("lock",2); diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index b6e1419b466..764d8eaeaa4 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -1,10 +1,10 @@ -slave stop; +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; -slave start; -slave stop; +start slave; +stop slave; reset master; reset slave; reset master; @@ -36,9 +36,9 @@ show binlog events from 79 limit 2,1; Log_name Pos Event_type Server_id Orig_log_pos Info master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL) flush logs; -slave start; +start slave; flush logs; -slave stop; +stop slave; create table t1 (n int); insert into t1 values (1); drop table t1; @@ -59,12 +59,12 @@ Log_name Pos Event_type Server_id Orig_log_pos Info master-bin.002 4 Query 1 4 use `test`; create table t1 (n int) master-bin.002 62 Query 1 62 use `test`; insert into t1 values (1) master-bin.002 122 Query 1 122 use `test`; drop table t1 -show master logs; +show binary logs; Log_name master-bin.001 master-bin.002 -slave start; -show master logs; +start slave; +show binary logs; Log_name slave-bin.001 slave-bin.002 diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index 6883da76180..394208e48d7 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; show master status; File Position Binlog_do_db Binlog_ignore_db master-bin.001 79 @@ -11,17 +11,17 @@ 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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124 change master to master_log_pos=73; -slave stop; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No No 0 0 73 4 -slave start; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4 change master to master_log_pos=173; -slave start; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4 @@ -33,7 +33,7 @@ drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); change master to master_log_pos=79; -slave start; +start slave; select * from t1; n 1 diff --git a/mysql-test/r/rpl_mystery22.result b/mysql-test/r/rpl_mystery22.result index 5dd665fe9d5..348b3211cd5 100644 --- a/mysql-test/r/rpl_mystery22.result +++ b/mysql-test/r/rpl_mystery22.result @@ -1,20 +1,20 @@ -slave stop; +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; -slave start; +start slave; create table t1(n int auto_increment primary key); insert into t1 values (2); insert into t1 values(NULL); insert into t1 values(NULL); delete from t1 where n = 2; -slave start; -slave stop; +start slave; +stop slave; create table t2(n int); drop table t2; insert into t1 values(NULL); -slave start; +start slave; select * from t1; n 1 diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result index 6103a075684..66c94a00b5f 100644 --- a/mysql-test/r/rpl_redirect.result +++ b/mysql-test/r/rpl_redirect.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space SHOW SLAVE HOSTS; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 63d5b0b63e1..42733915d56 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -1,13 +1,13 @@ -slave start; +start slave; Could not initialize master info structure, check permisions on master.info -slave start; +start slave; Could not initialize master info structure, check permisions on master.info change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; Could not initialize master info reset slave; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; reset master; -slave start; +start slave; drop table if exists t1, t2, t3, t4; create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables"); @@ -25,7 +25,7 @@ drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; -show master logs; +show binary logs; Log_name master-bin.001 master-bin.002 @@ -39,9 +39,9 @@ insert into t2 values(1234); set insert_id=1234; insert into t2 values(NULL); set global sql_slave_skip_counter=1; -slave start; +start slave; purge master logs to 'master-bin.003'; -show master logs; +show binary logs; Log_name master-bin.003 insert into t2 values (65); @@ -60,7 +60,7 @@ insert into temp_table values ("testing temporary tables part 2"); drop table if exists t3; create table t3 (n int); create table t4 select * from temp_table; -show master logs; +show binary logs; Log_name master-bin.003 master-bin.004 diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result index 946d64ad7c5..91aae09001f 100644 --- a/mysql-test/r/rpl_skip_error.result +++ b/mysql-test/r/rpl_skip_error.result @@ -1,9 +1,9 @@ -slave stop; +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; -slave start; +start slave; drop table if exists t1; create table t1 (n int not null primary key); insert into t1 values (1); diff --git a/mysql-test/r/rpl_sporadic_master.result b/mysql-test/r/rpl_sporadic_master.result index a6a58515f0a..789c3bf2b2b 100644 --- a/mysql-test/r/rpl_sporadic_master.result +++ b/mysql-test/r/rpl_sporadic_master.result @@ -1,16 +1,16 @@ -slave stop; +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; -slave start; +start slave; create table t2(n int); create table t1(n int not null auto_increment primary key); insert into t1 values (NULL),(NULL); truncate table t1; insert into t1 values (4),(NULL); -slave stop; -slave start; +stop slave; +start slave; insert into t1 values (NULL),(NULL); flush logs; truncate table t1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 462abb29979..2e8d7d19465 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -93,13 +93,13 @@ c int not null comment 'int column' show create table t1 ; Table Create Table t1 CREATE TABLE `t1` ( - `test_set` set('val1','val2','val3') NOT NULL default '', + `test_set` set('val1','val2','val3') character set latin1 NOT NULL default '', `name` char(20) character set latin1 default 'O''Brien' COMMENT 'O''Brien as default', `c` int(11) NOT NULL default '0' COMMENT 'int column' ) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table' show full columns from t1; Field Type Null Key Default Extra Privileges Comment -test_set set('val1','val2','val3') select,insert,update,references +test_set set('val1','val2','val3') character set latin1 select,insert,update,references name char(20) character set latin1 YES O'Brien select,insert,update,references O'Brien as default c int(11) 0 select,insert,update,references int column drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 2dcafe2c9cb..5c5b8984102 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -198,4 +198,22 @@ EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002 id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY No tables used 2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index +SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'; +date +2002-08-03 +SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'); +(SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03') +2002-08-03 +SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; +1 +1 +1 +1 +SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; +Subselect returns more than 1 record +EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY searchconthardwarefr3 index NULL topic 3 NULL 2 Using index +2 SUBSELECT No tables used +3 UNION No tables used drop table searchconthardwarefr3; diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index c0f0be246c9..51e11d259eb 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1626,13 +1626,13 @@ create table t1 (a enum (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') NOT NULL default '' + `a` enum('','a','b') character set latin1 NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') NOT NULL default 'b' + `a` enum('','a','b') character set latin1 NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 01149b68935..d0f964e4641 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -61,8 +61,8 @@ blob_col blob YES NULL select,insert,update,references tinyblob_col tinyblob YES NULL select,insert,update,references mediumblob_col mediumblob select,insert,update,references longblob_col longblob select,insert,update,references -options enum('one','two','tree') MUL one select,insert,update,references -flags set('one','two','tree') select,insert,update,references +options enum('one','two','tree') character set latin1 MUL one select,insert,update,references +flags set('one','two','tree') character set latin1 select,insert,update,references show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE @@ -190,8 +190,8 @@ date_time datetime YES NULL select,insert,update,references new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references tinyblob_col tinyblob YES NULL select,insert,update,references mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') MUL one select,insert,update,references -flags set('one','two','tree') select,insert,update,references +options enum('one','two','tree') character set latin1 MUL one select,insert,update,references +flags set('one','two','tree') character set latin1 select,insert,update,references new_field varchar(10) character set latin1 new select,insert,update,references show full columns from t2; Field Type Null Key Default Extra Privileges Comment @@ -216,8 +216,8 @@ date_time datetime YES NULL select,insert,update,references new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references tinyblob_col tinyblob YES NULL select,insert,update,references mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') one select,insert,update,references -flags set('one','two','tree') select,insert,update,references +options enum('one','two','tree') character set latin1 one select,insert,update,references +flags set('one','two','tree') character set latin1 select,insert,update,references new_field varchar(10) character set latin1 new select,insert,update,references select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); auto auto diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index b0ea1b69e59..256937c586a 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -3,13 +3,13 @@ create table t1 (a set (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') NOT NULL default '' + `a` set('','a','b') character set latin1 NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') NOT NULL default 'b' + `a` set('','a','b') character set latin1 NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test index cdbc2dbe0e4..0005b631a46 100644 --- a/mysql-test/t/bdb-crash.test +++ b/mysql-test/t/bdb-crash.test @@ -1,4 +1,5 @@ -- source include/have_bdb.inc + # test for bug reported by Mark Steele drop table if exists t1; diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index 0f195c65fb0..ce6897e63e1 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -12,11 +12,11 @@ select * from t1; save_master_pos; connection slave; sync_with_master; -slave stop; +stop slave; connection master; set password for root@"localhost" = password('foo'); connection slave; -slave start; +start slave; connection master; # # Give slave time to do at last one failed connect retry @@ -43,7 +43,7 @@ sync_with_master; connection master; reset master; connection slave; -slave stop; +stop slave; reset slave; connection master; @@ -62,7 +62,7 @@ enable_query_log; # Try to cause a large relay log lag on the slave connection slave; select get_lock("hold_slave",10); -slave start; +start slave; #hope this is long enough for I/O thread to fetch over 16K relay log data sleep 3; select release_lock("hold_slave"); @@ -100,7 +100,7 @@ wait_for_slave_to_stop; # show slave status; set global sql_slave_skip_counter=1; -slave start; +start slave; select count(*) from t1; connection master1; drop table t1; diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test index caf0b4ef6d8..5fabe0d2c59 100644 --- a/mysql-test/t/rpl000002.test +++ b/mysql-test/t/rpl000002.test @@ -3,18 +3,14 @@ drop table if exists t1; create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; connection master; --replace_result $SLAVE_MYPORT 9999 show slave hosts; drop table t1; -save_master_pos; -connection slave; -sync_with_master; -slave stop; +sync_slave_with_master; +stop slave; connection master; drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); @@ -23,11 +19,9 @@ insert into t2 set created=now(); select * from t2; save_master_pos; connection slave; -slave start; +start slave; sync_with_master; select * from t2; connection master; drop table t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl000011.test b/mysql-test/t/rpl000011.test index d75937e3f81..dc84741694c 100644 --- a/mysql-test/t/rpl000011.test +++ b/mysql-test/t/rpl000011.test @@ -2,20 +2,14 @@ source include/master-slave.inc; drop table if exists t1; create table t1 (n int); insert into t1 values(1); -save_master_pos; -connection slave; -sync_with_master; -slave stop; -slave start; +sync_slave_with_master; +stop slave; +start slave; connection master; insert into t1 values(2); -save_master_pos; -connection slave; #let slave catch up -sync_with_master; +sync_slave_with_master; select * from t1; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index c42e14699c5..37155d33f08 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -18,7 +18,7 @@ eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$MASTER_MYPORT; --replace_result $MASTER_MYPORT MASTER_PORT show slave status; -slave start; +start slave; sync_with_master; --replace_result $MASTER_MYPORT MASTER_PORT show slave status; @@ -26,12 +26,8 @@ connection master; drop table if exists t1; create table t1 (n int); insert into t1 values (10),(45),(90); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index f346ca39ca0..3bff9b4cbd8 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -5,17 +5,13 @@ reset master; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; connection slave; -slave start; +start slave; connection master; drop table if exists t1; create table t1(n int); insert into t1 values(24); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test index 291b482b912..e992f7938eb 100644 --- a/mysql-test/t/rpl000018.test +++ b/mysql-test/t/rpl000018.test @@ -10,18 +10,14 @@ server_stop master; server_start master; connection slave; reset slave; -slave start; +start slave; connection master; -show master logs; +show binary logs; drop table if exists t1; create table t1(n int); insert into t1 values (3351); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_failsafe.test b/mysql-test/t/rpl_failsafe.test index 866efbce5bf..ae61b061153 100644 --- a/mysql-test/t/rpl_failsafe.test +++ b/mysql-test/t/rpl_failsafe.test @@ -7,18 +7,16 @@ show variables like 'rpl_recovery_rank'; show status like 'Rpl_status'; create table t1(n int); drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; show variables like 'rpl_recovery_rank'; show status like 'Rpl_status'; connection slave_sec; -slave start; +start slave; sync_with_master; show variables like 'rpl_recovery_rank'; show status like 'Rpl_status'; connection slave_ter; -slave start; +start slave; sync_with_master; show variables like 'rpl_recovery_rank'; show status like 'Rpl_status'; diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test index c68fbb7111a..62bcf2c8b33 100644 --- a/mysql-test/t/rpl_flush_log_loop.test +++ b/mysql-test/t/rpl_flush_log_loop.test @@ -7,13 +7,13 @@ connection slave; --replace_result $MASTER_MYPORT MASTER_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$MASTER_MYPORT; -slave start; +start slave; connection master; -slave stop; +stop slave; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$SLAVE_MYPORT; -slave start; +start slave; flush logs; sleep 5; --replace_result $SLAVE_MYPORT SLAVE_PORT diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test index 85782e78142..729f8b06e18 100644 --- a/mysql-test/t/rpl_log.test +++ b/mysql-test/t/rpl_log.test @@ -2,7 +2,7 @@ source include/master-slave.inc; #clean up slave binlogs connection slave; -slave stop; +stop slave; reset master; reset slave; let $VERSION=`select version()`; @@ -26,10 +26,10 @@ flush logs; save_master_pos; connection slave; -slave start; +start slave; sync_with_master; flush logs; -slave stop; +stop slave; connection master; # Create some entries for second log @@ -40,12 +40,12 @@ drop table t1; --replace_result $VERSION VERSION show binlog events; show binlog events in 'master-bin.002'; -show master logs; +show binary logs; save_master_pos; connection slave; -slave start; +start slave; sync_with_master; -show master logs; +show binary logs; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION show binlog events in 'slave-bin.001' from 4; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index b96d32c7fca..d320796edd3 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -3,25 +3,23 @@ # source include/master-slave.inc; show master status; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; change master to master_log_pos=73; sleep 5; -slave stop; +stop slave; change master to master_log_pos=73; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; -slave start; +start slave; sleep 5; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; change master to master_log_pos=173; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT -slave start; +start slave; sleep 2; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; @@ -34,11 +32,9 @@ insert into t1 values (1),(2),(3); save_master_pos; connection slave; change master to master_log_pos=79; -slave start; +start slave; sync_with_master; select * from t1; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test index 5280cb360dd..d49f1a210f4 100644 --- a/mysql-test/t/rpl_mystery22.test +++ b/mysql-test/t/rpl_mystery22.test @@ -4,9 +4,7 @@ source include/master-slave.inc; # first, cause a duplicate key problem on the slave create table t1(n int auto_increment primary key); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; insert into t1 values (2); connection master; insert into t1 values(NULL); @@ -16,11 +14,11 @@ connection slave; sleep 3; # there is no way around this sleep - we have to wait until # the slave tries to run the query, fails and aborts slave thread delete from t1 where n = 2; -slave start; +start slave; sync_with_master; #now the buggy slave would be confused on the offset but it can replicate #in order to make it break, we need to stop/start the slave one more time -slave stop; +stop slave; connection master; # to be able to really confuse the slave, we need some non-auto-increment # events in the log @@ -29,7 +27,7 @@ drop table t2; insert into t1 values(NULL); save_master_pos; connection slave; -slave start; +start slave; #now the truth comes out - if the slave is buggy, it will never sync because #the slave thread is not able to read events sync_with_master; @@ -37,7 +35,5 @@ select * from t1; #clean up connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 5d8f150cdea..ad584c334b8 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -15,10 +15,10 @@ system cat /dev/null > var/slave-data/master.info; system chmod 000 var/slave-data/master.info; connection slave; --error 1201 -slave start; +start slave; system chmod 600 var/slave-data/master.info; --error 1201 -slave start; +start slave; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT # Will get error 13 on Unix systems becasue file is not readable !eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; @@ -28,7 +28,7 @@ eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master connection master; reset master; connection slave; -slave start; +start slave; connection master; drop table if exists t1, t2, t3, t4; @@ -40,9 +40,7 @@ create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables"); create table t1 (s text); insert into t1 values('Could not break slave'),('Tried hard'); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; select * from t1; @@ -52,12 +50,10 @@ drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; -show master logs; +show binary logs; create table t3 select * from temp_table; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t3; connection master; @@ -83,21 +79,17 @@ wait_for_slave_to_stop; #restart slave skipping one event set global sql_slave_skip_counter=1; -slave start; +start slave; connection master; -save_master_pos; #let slave catch up -connection slave; -sync_with_master; +sync_slave_with_master; connection master; purge master logs to 'master-bin.003'; -show master logs; +show binary logs; insert into t2 values (65); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; select * from t2; @@ -121,12 +113,12 @@ while ($1) } enable_query_log; create table t4 select * from temp_table; -show master logs; +show binary logs; show master status; save_master_pos; connection slave; -#slave stop; -#slave start; +#stop slave; +#start slave; sync_with_master; select * from t4; @@ -140,6 +132,4 @@ unlock tables; #clean up connection master; drop table if exists t1,t2,t3,t4; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test index e59b93b4475..b24901c62a9 100644 --- a/mysql-test/t/rpl_sporadic_master.test +++ b/mysql-test/t/rpl_sporadic_master.test @@ -9,22 +9,16 @@ insert into t1 values (NULL),(NULL); truncate table t1; # We have to use 4 in the following to make this test work with all table types insert into t1 values (4),(NULL); -save_master_pos; -connection slave; -sync_with_master; -slave stop; -slave start; +sync_slave_with_master; +stop slave; +start slave; connection master; insert into t1 values (NULL),(NULL); flush logs; truncate table t1; insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select * from t1; connection master; drop table t1,t2; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 518ade7fcf7..c74922d3d9e 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -108,4 +108,10 @@ INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'; EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'); +SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'; +SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'); +SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; +-- error 1240 +SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; +EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1); drop table searchconthardwarefr3;
\ No newline at end of file diff --git a/mysys/my_init.c b/mysys/my_init.c index ee39f7201ca..2f5088d5b9e 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -217,6 +217,10 @@ static void my_win_init(void) setlocale(LC_CTYPE, ""); /* To get right sortorder */ + /* Clear the OS system variable TZ and avoid the 100% CPU usage */ + _putenv( "TZ=" ); + _tzset(); + /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0, KEY_READ,&hSoftMysql) != ERROR_SUCCESS) @@ -240,7 +244,7 @@ static void my_win_init(void) /* Inserisce i dati come variabili d'ambiente */ my_env=strdup(EnvString); /* variable for putenv must be allocated ! */ - putenv(EnvString) ; + putenv(my_env) ; dimNameValueBuffer = dimName ; dimDataValueBuffer = dimData ; diff --git a/scripts/mysql_convert_table_format.sh b/scripts/mysql_convert_table_format.sh index 6b9a75228d3..c1955e632fb 100644 --- a/scripts/mysql_convert_table_format.sh +++ b/scripts/mysql_convert_table_format.sh @@ -64,7 +64,7 @@ foreach $table (@ARGV) { if (uc($row->[1]) eq uc($opt_type)) { - print "$table is alread of type $opt_type; Ignored\n"; + print "$table is already of type $opt_type; Ignored\n"; next; } } diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 1366a9ea713..b868006ee40 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -4,7 +4,7 @@ use Getopt::Long; use POSIX qw(strftime); $|=1; -$VER="2.3"; +$VER="2.4"; $opt_config_file = undef(); $opt_example = 0; @@ -508,8 +508,8 @@ sub example [mysqld_multi] mysqld = @bindir@/mysqld_safe mysqladmin = @bindir@/mysqladmin -user = multi_admin -password = multipass +user = root +password = your_password [mysqld2] socket = /tmp/mysql.sock2 diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index d808ffdcaef..bc23c0e5d95 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -559,15 +559,15 @@ sub copy_files { my @cp = ($method); # add option to preserve mod time etc of copied files # not critical, but nice to have - push @cp, "-p" if $^O =~ m/^(solaris|linux|freebsd)$/; + push @cp, "-p" if $^O =~ m/^(solaris|linux|freebsd|darwin)$/; # add recursive option for scp - push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; + push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd|darwin)$/ && $method =~ /^scp\b/; my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files; # add files to copy and the destination directory -+ safe_system( @cp, @non_raid, "'$target'" ); + safe_system( @cp, @non_raid, "'$target'" ); foreach my $rd ( @$raid_dirs ) { my @raid = map { "'$_'" } grep { m:$rd/: } @$files; diff --git a/sql/field.cc b/sql/field.cc index cdbe05669d0..8f61e053d27 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3734,10 +3734,9 @@ void Field_datetime::sql_type(String &res) const int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) { - field_charset=cs; int error= 0; #ifdef USE_TIS620 - if (!binary_flag) { + if (!binary()) { ThNormalize((uchar *)ptr, field_length, (uchar *)from, length); if (length < field_length) { bfill(ptr + length, field_length - length, ' '); @@ -3828,9 +3827,6 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)), int Field_string::cmp(const char *a_ptr, const char *b_ptr) { - if (binary_flag) - return memcmp(a_ptr,b_ptr,field_length); - else return my_strnncoll(field_charset, (const uchar*)a_ptr,field_length, (const uchar*)b_ptr,field_length); @@ -3838,7 +3834,7 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr) void Field_string::sort_string(char *to,uint length) { - if (binary_flag) + if (binary()) memcpy((byte*) to,(byte*) ptr,(size_t) length); else { @@ -3868,7 +3864,7 @@ void Field_string::sql_type(String &res) const "varchar" : "char"), (int) field_length)); res.length((uint) length); - if (binary_flag) + if (binary()) res.append(" binary"); else { @@ -3904,7 +3900,7 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length) uint a_length= (uint) (uchar) *a++; uint b_length= (uint) (uchar) *b++; - if (binary_flag) + if (binary()) { int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); @@ -3923,7 +3919,7 @@ int Field_string::pack_cmp(const char *b, uint length) end--; uint a_length = (uint) (end - ptr); - if (binary_flag) + if (binary()) { int cmp= memcmp(ptr,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); @@ -3956,9 +3952,8 @@ uint Field_string::max_packed_col_length(uint max_length) int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) { int error= 0; - field_charset=cs; #ifdef USE_TIS620 - if (!binary_flag) + if (!binary()) { ThNormalize((uchar *) ptr+2, field_length, (uchar *) from, length); } @@ -4036,10 +4031,7 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr) uint a_length=uint2korr(a_ptr); uint b_length=uint2korr(b_ptr); int diff; - if (binary_flag) - diff=memcmp(a_ptr+2,b_ptr+2,min(a_length,b_length)); - else - diff=my_strnncoll(field_charset, + diff=my_strnncoll(field_charset, (const uchar*)a_ptr+2,min(a_length,b_length), (const uchar*)b_ptr+2,min(a_length,b_length)); return diff ? diff : (int) (a_length - b_length); @@ -4048,7 +4040,7 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr) void Field_varstring::sort_string(char *to,uint length) { uint tot_length=uint2korr(ptr); - if (binary_flag) + if (binary()) memcpy((byte*) to,(byte*) ptr+2,(size_t) tot_length); else { @@ -4080,7 +4072,7 @@ void Field_varstring::sql_type(String &res) const ((char*) res.ptr(),"varchar(%u)", field_length)); res.length((uint) length); - if (binary_flag) + if (binary()) res.append(" binary"); else { @@ -4137,7 +4129,7 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length) a_length= (uint) (uchar) *a++; b_length= (uint) (uchar) *b++; } - if (binary_flag) + if (binary()) { int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); @@ -4160,7 +4152,7 @@ int Field_varstring::pack_cmp(const char *b, uint key_length) { b_length= (uint) (uchar) *b++; } - if (binary_flag) + if (binary()) { int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); @@ -4192,15 +4184,13 @@ uint Field_varstring::max_packed_col_length(uint max_length) Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,uint blob_pack_length, - bool binary_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str(ptr_arg, (1L << min(blob_pack_length,3)*8)-1L, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, cs), - packlength(blob_pack_length),binary_flag(binary_arg), geom_flag(true) + packlength(blob_pack_length), geom_flag(true) { flags|= BLOB_FLAG; - if (binary_arg) - flags|=BINARY_FLAG; if (table) table->blob_fields++; } @@ -4289,7 +4279,6 @@ uint32 Field_blob::get_length(const char *pos) int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs) { - field_charset=cs; if (!len) { bzero(ptr,Field_blob::pack_length()); @@ -4303,7 +4292,7 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs) if (table->copy_blobs || len <= MAX_FIELD_WIDTH) { // Must make a copy #ifdef USE_TIS620 - if (!binary_flag) + if (!binary()) { /* If there isn't enough memory, use original string */ if ((th_ptr=(char * ) my_malloc(sizeof(char) * len,MYF(0)))) @@ -4390,13 +4379,9 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)), int Field_blob::cmp(const char *a,uint32 a_length, const char *b, uint32 b_length) { - int diff; - if (binary_flag) - diff=memcmp(a,b,min(a_length,b_length)); - else - diff=my_strnncoll(field_charset, - (const uchar*)a,min(a_length,b_length), - (const uchar*)b,min(a_length,b_length)); + int diff=my_strnncoll(field_charset, + (const uchar*)a,min(a_length,b_length), + (const uchar*)b,min(a_length,b_length)); return diff ? diff : (int) (a_length - b_length); } @@ -4542,7 +4527,7 @@ void Field_blob::sort_string(char *to,uint length) if (blob_length > length) blob_length=length; memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); - if (binary_flag) + if (binary()) { memcpy(to,blob,blob_length); to+=blob_length; @@ -4579,8 +4564,8 @@ void Field_blob::sql_type(String &res) const case 4: str="long"; break; } res.set(str,(uint) strlen(str),default_charset_info); - res.append(binary_flag ? "blob" : "text"); - if (!binary_flag) + res.append(binary() ? "blob" : "text"); + if (!binary()) { res.append(" character set "); res.append(field_charset->name); @@ -4640,7 +4625,7 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length) a_length= (uint) (uchar) *a++; b_length= (uint) (uchar) *b++; } - if (binary_flag) + if (binary()) { int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); @@ -4668,7 +4653,7 @@ int Field_blob::pack_cmp(const char *b, uint key_length) { b_length= (uint) (uchar) *b++; } - if (binary_flag) + if (binary()) { int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); @@ -4921,7 +4906,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)), else val_ptr->set((const char*) typelib->type_names[tmp-1], (uint) strlen(typelib->type_names[tmp-1]), - default_charset_info); + field_charset); return val_ptr; } @@ -4962,6 +4947,15 @@ void Field_enum::sql_type(String &res) const flag=1; } res.append(')'); + if (binary()) + { + res.append(" binary"); + } + else + { + res.append(" character set "); + res.append(field_charset->name); + } } @@ -5065,7 +5059,7 @@ String *Field_set::val_str(String *val_buffer, val_buffer->append(field_separator); String str(typelib->type_names[bitnr], (uint) strlen(typelib->type_names[bitnr]), - default_charset_info); + field_charset); val_buffer->append(str); } tmp>>=1; @@ -5089,6 +5083,15 @@ void Field_set::sql_type(String &res) const flag=1; } res.append(')'); + if (binary()) + { + res.append(" binary"); + } + else + { + res.append(" character set "); + res.append(field_charset->name); + } } /* returns 1 if the fields are equally defined */ @@ -5187,6 +5190,7 @@ Field *make_field(char *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, + CHARSET_INFO *field_charset, Field::utype unireg_check, TYPELIB *interval, const char *field_name, @@ -5201,9 +5205,7 @@ Field *make_field(char *ptr, uint32 field_length, { if (!f_is_packed(pack_flag)) return new Field_string(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, - f_is_binary(pack_flag) != 0, - default_charset_info); + unireg_check, field_name, table, field_charset); uint pack_length=calc_pack_length((enum_field_types) f_packtype(pack_flag), @@ -5212,23 +5214,22 @@ Field *make_field(char *ptr, uint32 field_length, if (f_is_blob(pack_flag)) return new Field_blob(ptr,null_pos,null_bit, unireg_check, field_name, table, - pack_length,f_is_binary(pack_flag) != 0, - default_charset_info); + pack_length, field_charset); if (f_is_geom(pack_flag)) return new Field_geom(ptr,null_pos,null_bit, unireg_check, field_name, table, - pack_length,f_is_binary(pack_flag) != 0); + pack_length); if (interval) { if (f_is_enum(pack_flag)) return new Field_enum(ptr,field_length,null_pos,null_bit, unireg_check, field_name, table, - pack_length, interval); + pack_length, interval, field_charset); else return new Field_set(ptr,field_length,null_pos,null_bit, unireg_check, field_name, table, - pack_length, interval); + pack_length, interval, field_charset); } } diff --git a/sql/field.h b/sql/field.h index a1a511075fb..e4c1bd046ab 100644 --- a/sql/field.h +++ b/sql/field.h @@ -129,7 +129,7 @@ public: tmp->table=new_table; tmp->key_start=tmp->part_of_key=tmp->part_of_sortkey=0; tmp->unireg_check=Field::NONE; - tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG | ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG); + tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG | ZEROFILL_FLAG | ENUM_FLAG | SET_FLAG); tmp->reset_fields(); } return tmp; @@ -198,7 +198,7 @@ public: uint fill_cache_field(struct st_cache_field *copy); virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_time(TIME *ltime); - virtual CHARSET_INFO *charset(void) { return 0; } + virtual CHARSET_INFO *charset(void) { return my_charset_bin; } friend bool reopen_table(THD *,struct st_table *,bool); friend int cre_myisam(my_string name, register TABLE *form, uint options, ulonglong auto_increment_value); @@ -263,6 +263,7 @@ public: CHARSET_INFO *charset(void) { return field_charset; } inline void set_charset(CHARSET_INFO *charset) { field_charset=charset; } + bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; } inline int cmp_image(char *buff,uint length) { if (binary()) @@ -740,28 +741,17 @@ public: class Field_string :public Field_str { - bool binary_flag; public: Field_string(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,bool binary_arg, CHARSET_INFO *cs) + struct st_table *table_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg,cs), - binary_flag(binary_arg) - { - if (binary_arg) - flags|=BINARY_FLAG; - } + unireg_check_arg, field_name_arg, table_arg,cs) {}; Field_string(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, bool binary_arg, CHARSET_INFO *cs) + struct st_table *table_arg, CHARSET_INFO *cs) :Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg, cs), - binary_flag(binary_arg) - { - if (binary_arg) - flags|=BINARY_FLAG; - } + NONE, field_name_arg, table_arg, cs) {}; enum_field_types type() const { @@ -770,9 +760,8 @@ public: FIELD_TYPE_VAR_STRING : FIELD_TYPE_STRING); } enum ha_base_keytype key_type() const - { return binary_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; } + { return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; } bool zero_pack() const { return 0; } - bool binary() const { return binary_flag; } void reset(void) { bfill(ptr,field_length,' '); } int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); @@ -795,34 +784,22 @@ public: class Field_varstring :public Field_str { - bool binary_flag; public: Field_varstring(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,bool binary_arg, CHARSET_INFO *cs) + struct st_table *table_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs), - binary_flag(binary_arg) - { - if (binary_arg) - flags|=BINARY_FLAG; - } + unireg_check_arg, field_name_arg, table_arg, cs) {}; Field_varstring(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, bool binary_arg, CHARSET_INFO *cs) + struct st_table *table_arg, CHARSET_INFO *cs) :Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg, cs), - binary_flag(binary_arg) - { - if (binary_arg) - flags|=BINARY_FLAG; - } + NONE, field_name_arg, table_arg, cs) {}; enum_field_types type() const { return FIELD_TYPE_VAR_STRING; } enum ha_base_keytype key_type() const - { return binary_flag ? HA_KEYTYPE_VARBINARY : HA_KEYTYPE_VARTEXT; } + { return binary() ? HA_KEYTYPE_VARBINARY : HA_KEYTYPE_VARTEXT; } bool zero_pack() const { return 0; } - bool binary() const { return binary_flag; } void reset(void) { bzero(ptr,field_length+2); } uint32 pack_length() const { return (uint32) field_length+2; } uint32 key_length() const { return (uint32) field_length; } @@ -849,26 +826,23 @@ public: class Field_blob :public Field_str { uint packlength; String value; // For temporaries - bool binary_flag; bool geom_flag; public: Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,uint blob_pack_length, - bool binary_arg, CHARSET_INFO *cs); + CHARSET_INFO *cs); Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, bool binary_arg, CHARSET_INFO *cs) + struct st_table *table_arg, CHARSET_INFO *cs) :Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg, table_arg, cs), - packlength(3),binary_flag(binary_arg), geom_flag(true) + packlength(3), geom_flag(true) { flags|= BLOB_FLAG; - if (binary_arg) - flags|=BINARY_FLAG; } enum_field_types type() const { return FIELD_TYPE_BLOB;} enum ha_base_keytype key_type() const - { return binary_flag ? HA_KEYTYPE_VARBINARY : HA_KEYTYPE_VARTEXT; } + { return binary() ? HA_KEYTYPE_VARBINARY : HA_KEYTYPE_VARTEXT; } int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr); @@ -892,7 +866,6 @@ public: inline uint32 get_length(uint row_offset=0) { return get_length(ptr+row_offset); } uint32 get_length(const char *ptr); - bool binary() const { return binary_flag; } inline void get_ptr(char **str) { memcpy_fixed(str,ptr+packlength,sizeof(char*)); @@ -940,15 +913,13 @@ class Field_geom :public Field_blob { public: Field_geom(char *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,uint blob_pack_length, - bool binary_arg) + struct st_table *table_arg,uint blob_pack_length) :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, table_arg, blob_pack_length,binary_arg, - default_charset_info) {} + field_name_arg, table_arg, blob_pack_length,my_charset_bin) {} Field_geom(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, bool binary_arg) + struct st_table *table_arg) :Field_blob(len_arg, maybe_null_arg, field_name_arg, - table_arg, binary_arg, default_charset_info) {} + table_arg, my_charset_bin) {} enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; } void get_key_image(char *buff,uint length, imagetype type); @@ -965,9 +936,10 @@ public: uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,uint packlength_arg, - TYPELIB *typelib_arg) + TYPELIB *typelib_arg, + CHARSET_INFO *charset_arg) :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, default_charset_info), + unireg_check_arg, field_name_arg, table_arg, charset_arg), packlength(packlength_arg),typelib(typelib_arg) { flags|=ENUM_FLAG; @@ -991,7 +963,6 @@ public: enum_field_types real_type() const { return FIELD_TYPE_ENUM; } virtual bool zero_pack() const { return 0; } bool optimize_range(uint idx) { return 0; } - bool binary() const { return 0; } bool eq_def(Field *field); }; @@ -1002,11 +973,11 @@ public: uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,uint32 packlength_arg, - TYPELIB *typelib_arg) + TYPELIB *typelib_arg, CHARSET_INFO *charset_arg) :Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, packlength_arg, - typelib_arg) + typelib_arg,charset_arg) { flags=(flags & ~ENUM_FLAG) | SET_FLAG; } @@ -1088,6 +1059,7 @@ public: Field *make_field(char *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, + CHARSET_INFO *cs, Field::utype unireg_check, TYPELIB *interval, const char *field_name, struct st_table *table); @@ -1135,7 +1107,6 @@ bool test_if_int(const char *str,int length); #define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15) #define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC)) #define f_is_alpha(x) (!f_is_num(x)) -#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) #define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL) #define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) diff --git a/sql/filesort.cc b/sql/filesort.cc index e1c673aca0b..6fb9c699ffc 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -498,7 +498,7 @@ static void make_sortkey(register SORTPARAM *param, #ifdef USE_STRCOLL if(use_strnxfrm(cs)) { - if (item->binary) + if (item->binary()) { if (res->ptr() != (char*) to) memcpy(to,res->ptr(),length); @@ -525,7 +525,7 @@ static void make_sortkey(register SORTPARAM *param, if (res->ptr() != (char*) to) memcpy(to,res->ptr(),length); bzero((char *)to+length,diff); - if (!item->binary) + if (!item->binary()) my_tosort(cs, (char*) to,length); #ifdef USE_STRCOLL } @@ -948,7 +948,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length) case STRING_RESULT: sortorder->length=sortorder->item->max_length; #ifdef USE_STRCOLL - if (!sortorder->item->binary) + if (!sortorder->item->binary()) { CHARSET_INFO *cs=sortorder->item->str_value.charset(); if (use_strnxfrm(cs)) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 2a7990a18ee..9aa63cc1435 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1404,7 +1404,7 @@ get_innobase_type_from_mysql_type( DBUG_ASSERT((ulint)FIELD_TYPE_DECIMAL < 256); switch (field->type()) { - case FIELD_TYPE_VAR_STRING: if (field->flags & BINARY_FLAG) { + case FIELD_TYPE_VAR_STRING: if (field->binary()) { return(DATA_BINARY); } else if (strcmp( @@ -1414,7 +1414,7 @@ get_innobase_type_from_mysql_type( } else { return(DATA_VARMYSQL); } - case FIELD_TYPE_STRING: if (field->flags & BINARY_FLAG) { + case FIELD_TYPE_STRING: if (field->binary()) { return(DATA_FIXBINARY); } else if (strcmp( diff --git a/sql/item.cc b/sql/item.cc index 05185a24f45..1beb6b257bd 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -37,7 +37,7 @@ void item_init(void) Item::Item() { marker=0; - binary=maybe_null=null_value=with_sum_func=unsigned_flag=0; + maybe_null=null_value=with_sum_func=unsigned_flag=0; name=0; decimals=0; max_length=0; next=current_thd->free_list; // Put in free list @@ -131,11 +131,8 @@ void Item_field::set_field(Field *field_par) decimals= field->decimals(); table_name=field_par->table_name; field_name=field_par->field_name; - binary=field_par->binary(); unsigned_flag=test(field_par->flags & UNSIGNED_FLAG); - /* For string fields copy character set from original field */ - if (!field_par->binary()) - str_value.set_charset(((Field_str*)field_par)->charset()); + str_value.set_charset(field_par->charset()); } const char *Item_ident::full_name() const @@ -670,7 +667,7 @@ int Item::save_in_field(Field *field) field->result_type() == STRING_RESULT) { String *result; - CHARSET_INFO *cs=field->binary()?default_charset_info:((Field_str*)field)->charset(); + CHARSET_INFO *cs=field->binary()?my_charset_bin:((Field_str*)field)->charset(); char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns str_value.set_quick(buff,sizeof(buff),cs); result=val_str(&str_value); @@ -702,7 +699,7 @@ int Item::save_in_field(Field *field) int Item_string::save_in_field(Field *field) { String *result; - CHARSET_INFO *cs=field->binary()?default_charset_info:((Field_str*)field)->charset(); + CHARSET_INFO *cs=field->binary()?my_charset_bin:((Field_str*)field)->charset(); result=val_str(&str_value); if (null_value) return set_field_to_null(field); @@ -741,15 +738,14 @@ inline uint char_val(char X) X-'a'+10); } -Item_varbinary::Item_varbinary(const char *str, uint str_length, - CHARSET_INFO *cs) +Item_varbinary::Item_varbinary(const char *str, uint str_length) { name=(char*) str-2; // Lex makes this start with 0x max_length=(str_length+1)/2; char *ptr=(char*) sql_alloc(max_length+1); if (!ptr) return; - str_value.set(ptr,max_length,cs); + str_value.set(ptr,max_length,my_charset_bin); char *end=ptr+max_length; if (max_length*2 != str_length) *ptr++=char_val(*str++); // Not even, assume 0 prefix @@ -759,7 +755,6 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length, str+=2; } *ptr=0; // Keep purify happy - binary=1; // Binary is default } longlong Item_varbinary::val_int() @@ -887,7 +882,6 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) max_length= (*ref)->max_length; maybe_null= (*ref)->maybe_null; decimals= (*ref)->decimals; - binary= (*ref)->binary; } return 0; } diff --git a/sql/item.h b/sql/item.h index 115e9426691..fc36148e443 100644 --- a/sql/item.h +++ b/sql/item.h @@ -43,7 +43,6 @@ public: uint8 marker,decimals; my_bool maybe_null; /* If item may be null */ my_bool null_value; /* if item is null */ - my_bool binary; my_bool unsigned_flag; my_bool with_sum_func; @@ -71,6 +70,7 @@ public: virtual double val_result() { return val(); } virtual longlong val_int_result() { return val_int(); } virtual String *str_result(String* tmp) { return val_str(tmp); } + virtual bool is_null_result() { return is_null(); } virtual table_map used_tables() const { return (table_map) 0L; } virtual bool basic_const_item() const { return 0; } virtual Item *new_item() { return 0; } /* Only for const items */ @@ -83,7 +83,10 @@ public: virtual void split_sum_func(List<Item> &fields) {} virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_time(TIME *ltime); - virtual bool is_null() { return 0; } + virtual bool is_null() { return 0; }; + virtual CHARSET_INFO *charset() const { return str_value.charset(); }; + virtual bool binary() const { return str_value.charset()->state & MY_CS_BINSORT ? 1 : 0 ; } + virtual void set_charset(CHARSET_INFO *cs) { str_value.set_charset(cs); } }; @@ -124,6 +127,7 @@ public: double val_result(); longlong val_int_result(); String *str_result(String* tmp); + bool is_null_result() { return result_field->is_null(); } bool send(THD *thd, String *str_arg) { return result_field->send(thd,str_arg); @@ -359,7 +363,7 @@ public: class Item_varbinary :public Item { public: - Item_varbinary(const char *str,uint str_length,CHARSET_INFO *cs); + Item_varbinary(const char *str,uint str_length); ~Item_varbinary() {} enum Type type() const { return VARBIN_ITEM; } double val() { return (double) Item_varbinary::val_int(); } @@ -398,25 +402,25 @@ public: double val() { double tmp=(*ref)->val_result(); - null_value=(*ref)->null_value; + null_value=(*ref)->is_null_result(); return tmp; } longlong val_int() { longlong tmp=(*ref)->val_int_result(); - null_value=(*ref)->null_value; + null_value=(*ref)->is_null_result(); return tmp; } String *val_str(String* tmp) { tmp=(*ref)->str_result(tmp); - null_value=(*ref)->null_value; + null_value=(*ref)->is_null_result(); return tmp; } bool is_null() { (void) (*ref)->val_int_result(); - return (*ref)->null_value; + return (*ref)->is_null_result(); } bool get_date(TIME *ltime,bool fuzzydate) { diff --git a/sql/item_buff.cc b/sql/item_buff.cc index b55a4dc66a0..7b8976bb572 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -56,7 +56,7 @@ bool Item_str_buff::cmp(void) } else if (null_value) return 0; // new and old value was null - else if (!item->binary) + else if (!item->binary()) tmp= sortcmp(&value,res) != 0; else tmp= stringcmp(&value,res) != 0; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 31197a0191e..b6ea4beb339 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -128,7 +128,7 @@ int Item_bool_func2::compare_string() if ((res2=args[1]->val_str(&tmp_value2))) { null_value=0; - return binary ? stringcmp(res1,res2) : sortcmp(res1,res2); + return binary() ? stringcmp(res1,res2) : sortcmp(res1,res2); } } null_value=1; @@ -199,7 +199,7 @@ longlong Item_func_equal::val_int() res2=args[1]->val_str(&tmp_value2); if (!res1 || !res2) return test(res1 == res2); - return (binary ? test(stringcmp(res1,res2) == 0) : + return (binary() ? test(stringcmp(res1,res2) == 0) : test(sortcmp(res1,res2) == 0)); } case REAL_RESULT: @@ -266,7 +266,7 @@ longlong Item_func_strcmp::val_int() null_value=1; return 0; } - int value= binary ? stringcmp(a,b) : sortcmp(a,b); + int value= binary() ? stringcmp(a,b) : sortcmp(a,b); null_value=0; return !value ? 0 : (value < 0 ? (longlong) -1 : (longlong) 1); } @@ -355,7 +355,7 @@ void Item_func_between::fix_length_and_dec() if (!args[0] || !args[1] || !args[2]) return; cmp_type=args[0]->result_type(); - if (args[0]->binary) + if (args[0]->binary()) string_compare=stringcmp; else string_compare=sortcmp; @@ -511,21 +511,22 @@ Item_func_if::fix_length_and_dec() if (null1) { cached_result_type= arg2_type; - binary= args[2]->binary; + set_charset(args[2]->charset()); } else if (null2) { cached_result_type= arg1_type; - binary= args[1]->binary; + set_charset(args[1]->charset()); } else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT) { cached_result_type = STRING_RESULT; - binary=args[1]->binary | args[2]->binary; + set_charset( (args[1]->binary() || args[2]->binary()) ? + my_charset_bin : args[1]->charset()); } else { - binary=1; // Number + set_charset(my_charset_bin); // Number if (arg1_type == REAL_RESULT || arg2_type == REAL_RESULT) cached_result_type = REAL_RESULT; else @@ -663,7 +664,7 @@ Item *Item_func_case::find_item(String *str) } if ((tmp=args[i]->val_str(str))) // If not null { - if (first_expr->binary || args[i]->binary) + if (first_expr->binary() || args[i]->binary()) { if (stringcmp(tmp,first_expr_str)==0) return args[i+1]; @@ -977,7 +978,7 @@ void Item_func_in::fix_length_and_dec() { switch (item->result_type()) { case STRING_RESULT: - if (item->binary) + if (item->binary()) array=new in_string(arg_count,(qsort_cmp) stringcmp); /* purecov: inspected */ else array=new in_string(arg_count,(qsort_cmp) sortcmp); @@ -1003,7 +1004,7 @@ void Item_func_in::fix_length_and_dec() { switch (item->result_type()) { case STRING_RESULT: - if (item->binary) + if (item->binary()) in_item= new cmp_item_binary_string; else in_item= new cmp_item_sort_string; @@ -1275,9 +1276,12 @@ longlong Item_func_like::val_int() return 0; } null_value=0; + if ((res->charset()->state & MY_CS_BINSORT) || + (res2->charset()->state & MY_CS_BINSORT)) + set_charset(my_charset_bin); if (canDoTurboBM) return turboBM_matches(res->ptr(), res->length()) ? 1 : 0; - if (binary) + if (binary()) return wild_compare(*res,*res2,escape) ? 0 : 1; else return wild_case_compare(*res,*res2,escape) ? 0 : 1; @@ -1359,7 +1363,9 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 1; /* purecov: inspected */ with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func; max_length=1; decimals=0; - binary=args[0]->binary || args[1]->binary; + if (args[0]->binary() || args[1]->binary()) + set_charset(my_charset_bin); + used_tables_cache=args[0]->used_tables() | args[1]->used_tables(); const_item_cache=args[0]->const_item() && args[1]->const_item(); if (!regex_compiled && args[1]->const_item()) @@ -1374,7 +1380,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) } int error; if ((error=regcomp(&preg,res->c_ptr(), - binary ? REG_EXTENDED | REG_NOSUB : + binary() ? REG_EXTENDED | REG_NOSUB : REG_EXTENDED | REG_NOSUB | REG_ICASE, res->charset()))) { @@ -1421,7 +1427,7 @@ longlong Item_func_regex::val_int() regex_compiled=0; } if (regcomp(&preg,res2->c_ptr(), - binary ? REG_EXTENDED | REG_NOSUB : + binary() ? REG_EXTENDED | REG_NOSUB : REG_EXTENDED | REG_NOSUB | REG_ICASE, res->charset())) @@ -1471,7 +1477,7 @@ void Item_func_like::turboBM_compute_suffixes(int* suff) *splm1 = pattern_len; - if (binary) + if (binary()) { int i; for (i = pattern_len - 2; i >= 0; i--) @@ -1574,7 +1580,7 @@ void Item_func_like::turboBM_compute_bad_character_shifts() for (i = bmBc; i < end; i++) *i = pattern_len; - if (binary) + if (binary()) { for (j = 0; j < plm1; j++) bmBc[pattern[j]] = plm1 - j; @@ -1605,7 +1611,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const const int tlmpl = text_len - pattern_len; /* Searching */ - if (binary) + if (binary()) { while (j <= tlmpl) { diff --git a/sql/item_func.cc b/sql/item_func.cc index 7e8213b4380..6fce3df683a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -75,7 +75,6 @@ Item_func::Item_func(List<Item> &list) Sets as a side effect the following class variables: maybe_null Set if any argument may return NULL - binary Set if any of the arguments is binary with_sum_func Set if any of the arguments contains a sum function used_table_cache Set to union of the arguments used table @@ -97,7 +96,6 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { Item **arg,**arg_end; char buff[STACK_BUFF_ALLOC]; // Max argument in function - binary=0; used_tables_cache=0; const_item_cache=1; @@ -105,24 +103,24 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 0; // Fatal error if flag is set! if (arg_count) { // Print purify happy + /* + Set return character set to first argument if we are returning a + string. + */ + if (result_type() == STRING_RESULT) + set_charset((*args)->charset()); for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++) { if ((*arg)->fix_fields(thd, tables, arg)) return 1; /* purecov: inspected */ if ((*arg)->maybe_null) maybe_null=1; - if ((*arg)->binary) - binary=1; + if ((*arg)->binary()) + set_charset(my_charset_bin); with_sum_func= with_sum_func || (*arg)->with_sum_func; used_tables_cache|=(*arg)->used_tables(); const_item_cache&= (*arg)->const_item(); } - /* - Set return character set to first argument if we are returning a - string. - */ - if (result_type() == STRING_RESULT) - str_value.set_charset((*args)->str_value.charset()); } fix_length_and_dec(); return 0; @@ -230,10 +228,10 @@ Field *Item_func::tmp_table_field(TABLE *t_arg) break; case STRING_RESULT: if (max_length > 255) - res= new Field_blob(max_length, maybe_null, name, t_arg, binary, + res= new Field_blob(max_length, maybe_null, name, t_arg, str_value.charset()); else - res= new Field_string(max_length, maybe_null, name, t_arg, binary, + res= new Field_string(max_length, maybe_null, name, t_arg, str_value.charset()); break; } @@ -743,17 +741,31 @@ double Item_func_round::val() double Item_func_rand::val() { + THD* thd = current_thd; if (arg_count) { // Only use argument once in query uint32 tmp= (uint32) (args[0]->val_int()); - randominit(¤t_thd->rand,(uint32) (tmp*0x10001L+55555555L), + randominit(&thd->rand,(uint32) (tmp*0x10001L+55555555L), (uint32) (tmp*0x10000001L)); #ifdef DELETE_ITEMS delete args[0]; #endif arg_count=0; } - return rnd(¤t_thd->rand); + else if (!thd->rand_used) + { + // no need to send a Rand log event if seed was given eg: RAND(seed), + // as it will be replicated in the query as such. + + // save the seed only the first time RAND() is used in the query + + // once events are forwarded rather than recreated, + // the following can be skipped if inside the slave thread + thd->rand_used=1; + thd->rand_saved_seed1=thd->rand.seed1; + thd->rand_saved_seed2=thd->rand.seed2; + } + return rnd(&thd->rand); } longlong Item_func_sign::val_int() @@ -778,7 +790,6 @@ void Item_func_min_max::fix_length_and_dec() decimals=0; max_length=0; maybe_null=1; - binary=0; cmp_type=args[0]->result_type(); for (uint i=0 ; i < arg_count ; i++) { @@ -789,8 +800,8 @@ void Item_func_min_max::fix_length_and_dec() if (!args[i]->maybe_null) maybe_null=0; cmp_type=item_cmp_type(cmp_type,args[i]->result_type()); - if (args[i]->binary) - binary=1; + if (args[i]->binary()) + set_charset(my_charset_bin); } } @@ -836,7 +847,7 @@ String *Item_func_min_max::val_str(String *str) res2= args[i]->val_str(res == str ? &tmp_value : str); if (res2) { - int cmp=binary ? stringcmp(res,res2) : sortcmp(res,res2); + int cmp=binary() ? stringcmp(res,res2) : sortcmp(res,res2); if ((cmp_sign < 0 ? cmp : -cmp) < 0) res=res2; } @@ -926,7 +937,7 @@ longlong Item_func_char_length::val_int() return 0; /* purecov: inspected */ } null_value=0; - return (longlong) (!args[0]->binary) ? res->numchars() : res->length(); + return (longlong) (!args[0]->binary()) ? res->numchars() : res->length(); } @@ -934,7 +945,7 @@ longlong Item_func_locate::val_int() { String *a=args[0]->val_str(&value1); String *b=args[1]->val_str(&value2); - bool binary_str = args[0]->binary || args[1]->binary; + bool binary_str = args[0]->binary() || args[1]->binary(); if (!a || !b) { null_value=1; @@ -989,7 +1000,7 @@ longlong Item_func_locate::val_int() return 0; } #endif /* USE_MB */ - return (longlong) (binary ? a->strstr(*b,start) : + return (longlong) (binary() ? a->strstr(*b,start) : (a->strstr_case(*b,start)))+1; } @@ -1033,7 +1044,7 @@ longlong Item_func_ord::val_int() null_value=0; if (!res->length()) return 0; #ifdef USE_MB - if (use_mb(res->charset()) && !args[0]->binary) + if (use_mb(res->charset()) && !args[0]->binary()) { register const char *str=res->ptr(); register uint32 n=0, l=my_ismbchar(res->charset(),str,str+res->length()); @@ -1232,7 +1243,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, args=arguments; /* Fix all arguments */ - func->binary=func->maybe_null=0; + func->maybe_null=0; used_tables_cache=0; const_item_cache=1; @@ -1253,8 +1264,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, { if ((*arg)->fix_fields(thd, tables, arg)) return 1; - if ((*arg)->binary) - func->binary=1; + if ((*arg)->binary()) + func->set_charset(my_charset_bin); if ((*arg)->maybe_null) func->maybe_null=1; func->with_sum_func= func->with_sum_func || (*arg)->with_sum_func; @@ -2169,8 +2180,9 @@ err: void Item_func_match::init_search(bool no_order) { + DBUG_ENTER("Item_func_match::init_search"); if (ft_handler) - return; + DBUG_VOID_RETURN; if (key == NO_SUCH_KEY) concat=new Item_func_concat_ws(new Item_string(" ",1, @@ -2183,7 +2195,7 @@ void Item_func_match::init_search(bool no_order) master->init_search(no_order); ft_handler=master->ft_handler; join_key=master->join_key; - return; + DBUG_VOID_RETURN; } String *ft_tmp= 0; @@ -2203,10 +2215,9 @@ void Item_func_match::init_search(bool no_order) join_key && !no_order); if (join_key) - { table->file->ft_handler=ft_handler; - return; - } + + DBUG_VOID_RETURN; } @@ -2356,13 +2367,14 @@ bool Item_func_match::eq(const Item *item, bool binary_cmp) const double Item_func_match::val() { + DBUG_ENTER("Item_func_match::val"); if (ft_handler == NULL) - return -1.0; + DBUG_RETURN(-1.0); if (join_key) { if (table->file->ft_handler) - return ft_handler->please->get_relevance(ft_handler); + DBUG_RETURN(ft_handler->please->get_relevance(ft_handler)); join_key=0; } @@ -2370,12 +2382,12 @@ double Item_func_match::val() { String *a= concat->val_str(&value); if ((null_value= (a == 0))) - return 0; - return ft_handler->please->find_relevance(ft_handler, - (byte *)a->ptr(), a->length()); + DBUG_RETURN(0); + DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, + (byte *)a->ptr(), a->length())); } else - return ft_handler->please->find_relevance(ft_handler, record, 0); + DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, record, 0)); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 198ab42558d..dc483f48044 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -232,6 +232,8 @@ String *Item_func_concat::val_str(String *str) use_as_buff= &tmp_value; for (i=1 ; i < arg_count ; i++) { + if (args[i]->binary()) + set_charset(my_charset_bin); if (res->length() == 0) { if (!(res=args[i]->val_str(str))) @@ -260,6 +262,7 @@ String *Item_func_concat::val_str(String *str) str->append(*res2); } res=str; + res->set_charset(charset()); } else if (res == &tmp_value) { @@ -271,6 +274,7 @@ String *Item_func_concat::val_str(String *str) if (tmp_value.replace(0,0,*res)) goto null; res= &tmp_value; + res->set_charset(charset()); use_as_buff=str; // Put next arg here } else if (tmp_value.is_alloced() && res2->ptr() >= tmp_value.ptr() && @@ -289,6 +293,7 @@ String *Item_func_concat::val_str(String *str) *res)) goto null; res= &tmp_value; + res->set_charset(charset()); use_as_buff=str; // Put next arg here } else @@ -298,6 +303,7 @@ String *Item_func_concat::val_str(String *str) tmp_value.append(*res2)) goto null; res= &tmp_value; + res->set_charset(charset()); use_as_buff=str; } } @@ -626,7 +632,7 @@ String *Item_func_reverse::val_str(String *str) ptr = (char *) res->ptr(); end=ptr+res->length(); #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { String tmpstr; tmpstr.copy(*res); @@ -689,7 +695,7 @@ String *Item_func_replace::val_str(String *str) goto null; #ifdef USE_MB - binary_str = (args[0]->binary || args[1]->binary || !use_mb(res->charset())); + binary_str = (args[0]->binary() || args[1]->binary() || !use_mb(res->charset())); #endif if (res2->length() == 0) @@ -797,7 +803,7 @@ String *Item_func_insert::val_str(String *str) args[3]->null_value) goto null; /* purecov: inspected */ #ifdef USE_MB - if (use_mb(res->charset()) && !args[0]->binary) + if (use_mb(res->charset()) && !args[0]->binary()) { start=res->charpos(start); length=res->charpos(length,start); @@ -870,7 +876,7 @@ String *Item_func_left::val_str(String *str) if (length <= 0) return &empty_string; #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) length = res->charpos(length); #endif if (res->length() > (ulong) length) @@ -878,7 +884,7 @@ String *Item_func_left::val_str(String *str) if (!res->alloced_length()) { // Don't change const str str_value= *res; // Not malloced string - str_value.set_charset(res->charset()); + set_charset(res->charset()); res= &str_value; } res->length((uint) length); @@ -919,7 +925,7 @@ String *Item_func_right::val_str(String *str) if (res->length() <= (uint) length) return res; /* purecov: inspected */ #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { uint start=res->numchars()-(uint) length; if (start<=0) return res; @@ -952,7 +958,7 @@ String *Item_func_substr::val_str(String *str) (arg_count == 3 && args[2]->null_value)))) return 0; /* purecov: inspected */ #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { start=res->charpos(start); length=res->charpos(length,start); @@ -1012,7 +1018,7 @@ String *Item_func_substr_index::val_str(String *str) return &empty_string; // Wrong parameters #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { const char *ptr=res->ptr(); const char *strend = ptr+res->length(); @@ -1166,7 +1172,7 @@ String *Item_func_rtrim::val_str(String *str) { char chr=(*remove_str)[0]; #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { while (ptr < end) { @@ -1183,7 +1189,7 @@ String *Item_func_rtrim::val_str(String *str) { const char *r_ptr=remove_str->ptr(); #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { loop: while (ptr + remove_length < end) @@ -1234,7 +1240,7 @@ String *Item_func_trim::val_str(String *str) while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length)) ptr+=remove_length; #ifdef USE_MB - if (use_mb(res->charset()) && !binary) + if (use_mb(res->charset()) && !binary()) { char *p=ptr; register uint32 l; @@ -1979,7 +1985,7 @@ outp: void Item_func_conv_charset::fix_length_and_dec() { max_length = args[0]->max_length*(conv_charset->mbmaxlen?conv_charset->mbmaxlen:1); - str_value.set_charset(conv_charset); + set_charset(conv_charset); } @@ -2054,7 +2060,6 @@ outp: bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables, Item **ref) { char buff[STACK_BUFF_ALLOC]; // Max argument in function - binary=0; used_tables_cache=0; const_item_cache=1; @@ -2063,9 +2068,8 @@ bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables, I if (args[0]->fix_fields(thd, tables, args)) return 1; maybe_null=args[0]->maybe_null; - binary=args[0]->binary; const_item_cache=args[0]->const_item(); - str_value.set_charset(conv_charset); + set_charset(conv_charset); fix_length_and_dec(); return 0; } @@ -2088,7 +2092,6 @@ String *Item_func_set_collation::val_str(String *str) bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables, Item **ref) { char buff[STACK_BUFF_ALLOC]; // Max argument in function - binary=0; used_tables_cache=0; const_item_cache=1; @@ -2097,8 +2100,7 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables, if (args[0]->fix_fields(thd, tables, args)) return 1; maybe_null=args[0]->maybe_null; - binary=args[0]->binary; - str_value.set_charset(set_collation); + set_charset(set_collation); with_sum_func= with_sum_func || args[0]->with_sum_func; used_tables_cache=args[0]->used_tables(); const_item_cache=args[0]->const_item(); diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 616c9b6a11f..c4b2534c7d0 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -411,7 +411,7 @@ class Item_func_char :public Item_str_func public: Item_func_char(List<Item> &list) :Item_str_func(list) {} String *val_str(String *); - void fix_length_and_dec() { maybe_null=0; max_length=arg_count; binary=0;} + void fix_length_and_dec() { maybe_null=0; max_length=arg_count; } const char *func_name() const { return "char"; } }; @@ -483,7 +483,11 @@ public: null_value=args[0]->null_value; return tmp; } - void fix_length_and_dec() { binary=1; max_length=args[0]->max_length; } + void fix_length_and_dec() + { + str_value.set_charset(my_charset_bin); + max_length=args[0]->max_length; + } void print(String *str) { print_op(str); } }; @@ -496,7 +500,11 @@ public: String *val_str(String *); const char *func_name() const { return "load_file"; } void fix_length_and_dec() - { binary=1; maybe_null=1; max_length=MAX_BLOB_WIDTH;} + { + str_value.set_charset(my_charset_bin); + maybe_null=1; + max_length=MAX_BLOB_WIDTH; + } }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 4d25098bb88..46e6b146380 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -160,7 +160,6 @@ 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; - binary=item->binary; unsigned_flag=item->unsigned_flag; result_field=0; null_value=1; @@ -380,7 +379,7 @@ bool Item_sum_min::add() String *result=args[0]->val_str(&tmp_value); if (!args[0]->null_value && (null_value || - (binary ? stringcmp(&value,result) : sortcmp(&value,result)) > 0)) + (binary() ? stringcmp(&value,result) : sortcmp(&value,result)) > 0)) { value.copy(*result); null_value=0; @@ -423,7 +422,7 @@ bool Item_sum_max::add() String *result=args[0]->val_str(&tmp_value); if (!args[0]->null_value && (null_value || - (binary ? stringcmp(&value,result) : sortcmp(&value,result)) < 0)) + (binary() & MY_CS_BINSORT ? stringcmp(&value,result) : sortcmp(&value,result)) < 0)) { value.copy(*result); null_value=0; @@ -693,7 +692,7 @@ Item_sum_hybrid::min_max_update_str_field(int offset) result_field->ptr-=offset; if (result_field->is_null() || - (cmp_sign * (binary ? stringcmp(res_str,&tmp_value) : + (cmp_sign * (binary() ? stringcmp(res_str,&tmp_value) : sortcmp(res_str,&tmp_value)) < 0)) result_field->store(res_str->ptr(),res_str->length(),res_str->charset()); else diff --git a/sql/log.cc b/sql/log.cc index 91ef42e1381..fd5f6d0d73f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1072,6 +1072,13 @@ bool MYSQL_LOG::write(Log_event* event_info) if (e.write(file)) goto err; } + if (thd && thd->rand_used) + { + Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2); + e.set_log_pos(this); + if (e.write(file)) + goto err; + } if (thd && thd->variables.convert_set) { char buf[1024] = "SET CHARACTER SET "; diff --git a/sql/log_event.cc b/sql/log_event.cc index 1e6fe924682..79c7fd8e99c 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -348,6 +348,18 @@ void Intvar_log_event::pack_info(String* packet) net_store_data(packet, tmp.ptr(), tmp.length()); } +void Rand_log_event::pack_info(String* packet) +{ + char buf1[256], buf[22]; + String tmp(buf1, sizeof(buf1), system_charset_info); + tmp.length(0); + tmp.append("randseed1="); + tmp.append(llstr(seed1, buf)); + tmp.append(",randseed2="); + tmp.append(llstr(seed2, buf)); + net_store_data(packet, tmp.ptr(), tmp.length()); +} + void Slave_log_event::pack_info(String* packet) { char buf1[256], buf[22], *end; @@ -376,6 +388,9 @@ void Log_event::init_show_field_list(List<Item>* field_list) field_list->push_back(new Item_empty_string("Info", 20)); } +/* + * only called by SHOW BINLOG EVENTS + */ int Log_event::net_send(THD* thd, const char* log_name, my_off_t pos) { String* packet = &thd->packet; @@ -610,6 +625,9 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len, case INTVAR_EVENT: ev = new Intvar_log_event(buf, old_format); break; + case RAND_EVENT: + ev = new Rand_log_event(buf, old_format); + break; default: break; } @@ -915,6 +933,41 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db) } #endif +/***************************************************************************** + * + * Rand log event + * + ****************************************************************************/ +Rand_log_event::Rand_log_event(const char* buf, bool old_format) + :Log_event(buf, old_format) +{ + buf += (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN; + seed1 = uint8korr(buf+RAND_SEED1_OFFSET); + seed2 = uint8korr(buf+RAND_SEED2_OFFSET); +} + +int Rand_log_event::write_data(IO_CACHE* file) +{ + char buf[16]; + int8store(buf + RAND_SEED1_OFFSET, seed1); + int8store(buf + RAND_SEED2_OFFSET, seed2); + return my_b_safe_write(file, (byte*) buf, sizeof(buf)); +} + +#ifdef MYSQL_CLIENT +void Rand_log_event::print(FILE* file, bool short_form, char* last_db) +{ + char llbuff[22]; + if (!short_form) + { + print_header(file); + fprintf(file, "\tRand\n"); + } + fprintf(file, "SET RAND SEED1=%s;\n", llstr(seed1, llbuff)); + fprintf(file, "SET RAND SEED2=%s;\n", llstr(seed2, llbuff)); + fflush(file); +} +#endif int Load_log_event::write_data_header(IO_CACHE* file) { @@ -1926,6 +1979,14 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli) return 0; } +int Rand_log_event::exec_event(struct st_relay_log_info* rli) +{ + thd->rand.seed1 = seed1; + thd->rand.seed2 = seed2; + rli->inc_pending(get_event_len()); + return 0; +} + int Slave_log_event::exec_event(struct st_relay_log_info* rli) { if (mysql_bin_log.is_open()) diff --git a/sql/log_event.h b/sql/log_event.h index 5f7aa4ad586..c0a1345647f 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -152,6 +152,11 @@ struct sql_ex_info #define I_TYPE_OFFSET 0 #define I_VAL_OFFSET 1 +/* Rand event post-header */ + +#define RAND_SEED1_OFFSET 0 +#define RAND_SEED2_OFFSET 8 + /* Load event post-header */ #define L_THREAD_ID_OFFSET 0 @@ -199,7 +204,7 @@ enum Log_event_type START_EVENT = 1, QUERY_EVENT =2, STOP_EVENT=3, ROTATE_EVENT = 4, INTVAR_EVENT=5, LOAD_EVENT=6, SLAVE_EVENT=7, CREATE_FILE_EVENT=8, APPEND_BLOCK_EVENT=9, EXEC_LOAD_EVENT=10, DELETE_FILE_EVENT=11, - NEW_LOAD_EVENT=12 + NEW_LOAD_EVENT=12, RAND_EVENT=13 }; enum Int_event_type @@ -497,11 +502,39 @@ public: bool is_valid() { return 1; } }; +/***************************************************************************** + * + * Rand log event class + * + ****************************************************************************/ +class Rand_log_event: public Log_event +{ + public: + ulonglong seed1; + ulonglong seed2; + +#ifndef MYSQL_CLIENT + Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg) + :Log_event(thd_arg),seed1(seed1_arg),seed2(seed2_arg) + {} + void pack_info(String* packet); + int exec_event(struct st_relay_log_info* rli); +#else + void print(FILE* file, bool short_form = 0, char* last_db = 0); +#endif + + Rand_log_event(const char* buf, bool old_format); + ~Rand_log_event() {} + Log_event_type get_type_code() { return RAND_EVENT;} + int get_data_size() { return sizeof(ulonglong) * 2; } + int write_data(IO_CACHE* file); + bool is_valid() { return 1; } +}; class Stop_log_event: public Log_event { public: -#ifndef MYSQL_CLIENT +#ifndef MYSQL_CLIENT Stop_log_event() :Log_event((THD*)0) {} int exec_event(struct st_relay_log_info* rli); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index eaa0bf3691a..685e713f39c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -290,7 +290,7 @@ int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice */ static bool kill_in_progress=FALSE; -static struct rand_struct sql_rand; +struct rand_struct sql_rand; // used by sql_class.cc:THD::THD() static int cleanup_done; static char **defaults_argv; char glob_hostname[FN_REFLEN]; @@ -2417,15 +2417,7 @@ static void create_new_thread(THD *thd) for (uint i=0; i < 8 ; i++) // Generate password teststring thd->scramble[i]= (char) (rnd(&sql_rand)*94+33); thd->scramble[8]=0; - /* - We need good random number initialization for new thread - Just coping global one will not work - */ - { - ulong tmp=(ulong) (rnd(&sql_rand) * 3000000); - randominit(&(thd->rand), tmp + (ulong) start_time, - tmp + (ulong) thread_id); - } + thd->real_id=pthread_self(); // Keep purify happy /* Start a new thread to handle connection */ diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index 129df9864e2..2d0eae125d6 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -426,7 +426,17 @@ BOOL NTService::SeekStatus(LPCSTR szInternName, int OperationType) // open a connection to the SCM if (!(scm = OpenSCManager(0, 0,SC_MANAGER_CREATE_SERVICE))) - printf("There is a problem with the Service Control Manager!\n"); + { + DWORD ret_error=GetLastError(); + if (ret_error == ERROR_ACCESS_DENIED) + { + printf("Install/Remove of the Service Denied!\n"); + if(!is_super_user()) + printf("That operation should be made by an user with Administrator privileges!\n"); + } + else + printf("There is a problem for to open the Service Control Manager!\n"); + } else { if (OperationType == 1) @@ -507,3 +517,82 @@ BOOL NTService::got_service_option(char **argv, char *service_option) return TRUE; return FALSE; } +/* ------------------------------------------------------------------------ + -------------------------------------------------------------------------- */ +BOOL NTService::is_super_user() +{ + HANDLE hAccessToken; + UCHAR InfoBuffer[1024]; + PTOKEN_GROUPS ptgGroups=(PTOKEN_GROUPS)InfoBuffer; + DWORD dwInfoBufferSize; + PSID psidAdministrators; + SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY; + UINT x; + BOOL ret_value=FALSE; + + if(!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) + { + if(GetLastError() != ERROR_NO_TOKEN) + return FALSE; + + if(!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) + return FALSE; + } + + ret_value= GetTokenInformation(hAccessToken,TokenGroups,InfoBuffer, + 1024, &dwInfoBufferSize); + + CloseHandle(hAccessToken); + + if(!ret_value ) + return FALSE; + + if(!AllocateAndInitializeSid(&siaNtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &psidAdministrators)) + return FALSE; + + ret_value = FALSE; + + for(x=0;x<ptgGroups->GroupCount;x++) + { + if( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) + { + ret_value = TRUE; + break; + } + + } + FreeSid(psidAdministrators); + return ret_value; +} +/* ------------------------------------------------------------------------ + -------------------------------------------------------------------------- */ +BOOL NTService::IsService(LPCSTR ServiceName) +{ + BOOL ret_value=FALSE; + SC_HANDLE service, scm; + + if (scm = OpenSCManager(0, 0,SC_MANAGER_ENUMERATE_SERVICE)) + { + if ((service = OpenService(scm,ServiceName, SERVICE_ALL_ACCESS ))) + { + ret_value=TRUE; + CloseServiceHandle(service); + } + CloseServiceHandle(scm); + } + return ret_value; +} +/* ------------------------------------------------------------------------ + -------------------------------------------------------------------------- */ +BOOL NTService::got_service_option(char **argv, char *service_option) +{ + char *option; + for (option= argv[1]; *option; option++) + if (!strcmp(option, service_option)) + return TRUE; + return FALSE; +} diff --git a/sql/nt_servc.h b/sql/nt_servc.h index ab3238e0f41..6d74eaccea2 100644 --- a/sql/nt_servc.h +++ b/sql/nt_servc.h @@ -54,7 +54,7 @@ class NTService BOOL Remove(LPCSTR szInternName); BOOL IsService(LPCSTR ServiceName); BOOL got_service_option(char **argv, char *service_option); - + BOOL is_super_user(); void Stop(void); //to be called from app. to stop service protected: diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2b0ac08fe95..39e6b83221d 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2238,7 +2238,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree, { tmp=param->table->file-> records_in_range((int) keynr,(byte*)(param->min_key + 1), - min_key_length, (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG), + min_key_length, (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG), (byte *)NullS,0,HA_READ_KEY_EXACT); } else @@ -2705,20 +2705,28 @@ int QUICK_SELECT_DESC::get_next() } else { + DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range)); +#ifdef NOT_IMPLEMENTED_YET + result=file->index_read(record, (byte*) range->max_key, + range->max_length, + ((range->flag & NEAR_MAX) ? + HA_READ_BEFORE_KEY : HA_READ_PREFIX_LAST_OR_PREV)); +#else /* Heikki changed Sept 11, 2002: since InnoDB does not store the cursor position if READ_KEY_EXACT is used to a primary key with all key columns specified, we must use below HA_READ_KEY_OR_NEXT, so that InnoDB stores the cursor position and is able to move the cursor one step backward after the search. */ - DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range)); /* Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will * do the right thing - go past all keys which match the prefix */ + result=file->index_read(record, (byte*) range->max_key, range->max_length, ((range->flag & NEAR_MAX) ? HA_READ_KEY_OR_NEXT : HA_READ_AFTER_KEY)); result = file->index_prev(record); +#endif } if (result) { diff --git a/sql/share/charsets/Index b/sql/share/charsets/Index index 8351d079ce1..b2d9fe3e2a1 100644 --- a/sql/share/charsets/Index +++ b/sql/share/charsets/Index @@ -17,7 +17,6 @@ swe7 10 usa7 11 ujis 12 sjis 13 -# cp1251 is depreciated. Use cp1251cias, cp1251csas or cp1251bin instead. cp1251 14 danish 15 hebrew 16 diff --git a/sql/share/charsets/cp1251.conf b/sql/share/charsets/cp1251.conf index 6af97c891b8..ee72c6e7b27 100644 --- a/sql/share/charsets/cp1251.conf +++ b/sql/share/charsets/cp1251.conf @@ -72,3 +72,22 @@ 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B + +# Unicode mapping (must be 256 elements) + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F + 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F + 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 + 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 + 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F + 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F + 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F + 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F + diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 363a194276b..deb1e2821c1 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -349,7 +349,7 @@ void field_str::add() if (length > max_length) max_length = length; - if (item->binary) + if (item->binary()) { if (stringcmp(res, &min_arg) < 0) min_arg.copy(*res); @@ -738,7 +738,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) { if (must_be_blob) { - if (item->binary) + if (item->binary()) answer->append("TINYBLOB", 8); else answer->append("TINYTEXT", 8); @@ -756,21 +756,21 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) } else if (max_length < (1L << 16)) { - if (item->binary) + if (item->binary()) answer->append("BLOB", 4); else answer->append("TEXT", 4); } else if (max_length < (1L << 24)) { - if (item->binary) + if (item->binary()) answer->append("MEDIUMBLOB", 10); else answer->append("MEDIUMTEXT", 10); } else { - if (item->binary) + if (item->binary()) answer->append("LONGBLOB", 8); else answer->append("LONGTEXT", 8); diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 3e8ddd67023..403ddbe6fee 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -115,7 +115,7 @@ public: max_arg("",default_charset_info), sum(0), must_be_blob(0), was_zero_fill(0), was_maybe_zerofill(0), can_be_still_num(1) - { init_tree(&tree, 0, 0, sizeof(String), a->binary ? + { init_tree(&tree, 0, 0, sizeof(String), a->binary() ? (qsort_cmp2) stringcmp2 : (qsort_cmp2) sortcmp2, 0, (tree_element_free) free_string, NULL); }; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 46afddf0967..d9818053e89 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1689,6 +1689,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ha_open_options, tmp_table)) { + my_free((char*) tmp_table,MYF(0)); DBUG_RETURN(0); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 083b0ed2543..8de536d066d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -37,6 +37,8 @@ #include <mysys_err.h> #include <assert.h> +extern struct rand_struct sql_rand; + /***************************************************************************** ** Instansiate templates *****************************************************************************/ @@ -79,7 +81,7 @@ static void free_var(user_var_entry *entry) THD::THD():user_time(0), fatal_error(0), last_insert_id_used(0), - insert_id_used(0), in_lock_tables(0), + insert_id_used(0), rand_used(0), in_lock_tables(0), global_read_lock(0), bootstrap(0) { host=user=priv_user=db=query=ip=0; @@ -172,6 +174,18 @@ THD::THD():user_time(0), fatal_error(0), transaction.trans_log.end_of_file= max_binlog_cache_size; } #endif + + /* + We need good random number initialization for new thread + Just coping global one will not work + */ + { + pthread_mutex_lock(&LOCK_thread_count); + ulong tmp=(ulong) (rnd(&sql_rand) * 3000000); + randominit(&rand, tmp + (ulong) start_time, + tmp + (ulong) thread_id); + pthread_mutex_unlock(&LOCK_thread_count); + } } /* Do operations that may take a long time */ @@ -873,8 +887,8 @@ bool select_singleval_subselect::send_data(List<Item> &items) Following val() call have to be first, because function AVG() & STD() calculate value on it & determinate "is it NULL?". */ - it->real_value= val_item->val(); - if ((it->null_value= val_item->is_null())) + it->real_value= val_item->val_result(); + if ((it->null_value= val_item->is_null_result())) { it->assign_null(); } @@ -882,9 +896,9 @@ bool select_singleval_subselect::send_data(List<Item> &items) { it->max_length= val_item->max_length; it->decimals= val_item->decimals; - it->binary= val_item->binary; - it->int_value= val_item->val_int(); - String *s= val_item->val_str(&it->string_value); + it->set_charset(val_item->charset()); + it->int_value= val_item->val_int_result(); + String *s= val_item->str_result(&it->string_value); if (s != &it->string_value) { it->string_value.set(*s, 0, s->length()); diff --git a/sql/sql_class.h b/sql/sql_class.h index 7b5a6da8c6b..e38a33f9ea7 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -499,9 +499,9 @@ public: uint8 query_cache_type; // type of query cache processing bool slave_thread; bool set_query_id,locked,count_cuted_fields,some_tables_deleted; - bool no_errors, allow_sum_func, password; - bool fatal_error; - bool query_start_used,last_insert_id_used,insert_id_used; + bool no_errors, allow_sum_func, password, fatal_error; + bool query_start_used,last_insert_id_used,insert_id_used,rand_used; + ulonglong rand_saved_seed1, rand_saved_seed2; bool system_thread,in_lock_tables,global_read_lock; bool query_error, bootstrap, cleanup_done; bool safe_to_cache_query; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index ea15f2e5417..c43869d9d55 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -88,7 +88,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok) } static enum enum_ha_read_modes rkey_to_rnext[]= - { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV }; + { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; int mysql_ha_read(THD *thd, TABLE_LIST *tables, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9f09afc78a6..b68316a1e4a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -944,6 +944,7 @@ void st_select_lex_unit::init_query() global_parameters= this; select_limit_cnt= HA_POS_ERROR; offset_limit_cnt= 0; + union_option= 0; prepared= optimized= 0; item= 0; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index de57e9f77a8..070eecb1797 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -240,6 +240,7 @@ public: bool depended; /* depended from outer select subselect */ /* not NULL if union used in subselect, point to subselect item */ Item_subselect *item; + uint union_option; void init_query(); bool create_total_list(THD *thd, st_lex *lex, TABLE_LIST **result); @@ -373,7 +374,7 @@ 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 grant, grant_tot_col, which_columns, union_option; + uint grant, grant_tot_col, which_columns; uint fk_delete_opt, fk_update_opt, fk_match_option; uint param_count; bool drop_primary, drop_if_exists, local_file, olap; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 046b5d45b59..fc9838f57b1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2904,7 +2904,6 @@ mysql_init_query(THD *thd) thd->select_number= thd->lex.select_lex.select_number= 1; thd->lex.value_list.empty(); thd->free_list= 0; - thd->lex.union_option= 0; thd->lex.select= &thd->lex.select_lex; thd->lex.olap=thd->lex.describe=0; thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE; @@ -2912,6 +2911,7 @@ mysql_init_query(THD *thd) thd->total_warn_count=0; // Warnings for this query thd->last_insert_id_used= thd->query_start_used= thd->insert_id_used=0; thd->sent_row_count= thd->examined_row_count= 0; + thd->rand_used=0; thd->safe_to_cache_query= 1; thd->lex.param_list.empty(); DBUG_VOID_RETURN; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6a48f56443c..b981ae329cd 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -371,7 +371,7 @@ JOIN::optimize() #endif conds=optimize_cond(conds,&cond_value); - if (thd->fatal_error) // Out of memory + if (thd->fatal_error || thd->net.report_error) { delete procedure; error = 0; @@ -3600,14 +3600,14 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item_sum::AVG_FUNC: /* Place for sum & count */ if (group) return new Field_string(sizeof(double)+sizeof(longlong), - maybe_null, item->name,table,1,default_charset_info); + maybe_null, item->name,table,my_charset_bin); else return new Field_double(item_sum->max_length,maybe_null, item->name, table, item_sum->decimals); case Item_sum::STD_FUNC: /* Place for sum & count */ if (group) return new Field_string(sizeof(double)*2+sizeof(longlong), - maybe_null, item->name,table,1,default_charset_info); + maybe_null, item->name,table,my_charset_bin); else return new Field_double(item_sum->max_length, maybe_null, item->name,table,item_sum->decimals); @@ -3624,9 +3624,9 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case STRING_RESULT: if (item_sum->max_length > 255) return new Field_blob(item_sum->max_length,maybe_null, - item->name,table,item->binary,default_charset_info); + item->name,table,item->str_value.charset()); return new Field_string(item_sum->max_length,maybe_null, - item->name,table,item->binary,default_charset_info); + item->name,table,item->str_value.charset()); } } thd->fatal_error=1; @@ -3678,12 +3678,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case STRING_RESULT: if (item->max_length > 255) new_field= new Field_blob(item->max_length,maybe_null, - item->name,table,item->binary, - item->str_value.charset()); + item->name,table,item->str_value.charset()); else new_field= new Field_string(item->max_length,maybe_null, - item->name,table,item->binary, - item->str_value.charset()); + item->name,table,item->str_value.charset()); break; } if (copy_func) @@ -4121,7 +4119,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, (uchar*) 0, (uint) 0, Field::NONE, - NullS, table, (bool) 1, default_charset_info); + NullS, table, my_charset_bin); key_part_info->key_type=FIELDFLAG_BINARY; key_part_info->type= HA_KEYTYPE_BINARY; key_part_info++; @@ -7253,16 +7251,18 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, select_result *result=join->result; Item *item_null= new Item_null(); DBUG_ENTER("select_describe"); - + DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s", + (ulong)join->select_lex, join->select_lex->type, + message)); /* Don't log this into the slow query log */ select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED); join->unit->offset_limit_cnt= 0; if (message) { - item_list.push_back(new Item_int((int32) thd->lex.select->select_number)); - item_list.push_back(new Item_string(thd->lex.select->type, - strlen(thd->lex.select->type), + item_list.push_back(new Item_int((int32) join->select_lex->select_number)); + item_list.push_back(new Item_string(join->select_lex->type, + strlen(join->select_lex->type), default_charset_info)); Item *empty= new Item_empty_string("",0); for (uint i=0 ; i < 7; i++) @@ -7287,9 +7287,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, tmp2.length(0); item_list.empty(); - item_list.push_back(new Item_int((int32) thd->lex.select->select_number)); - item_list.push_back(new Item_string(thd->lex.select->type, - strlen(thd->lex.select->type), + item_list.push_back(new Item_int((int32) + join->select_lex->select_number)); + item_list.push_back(new Item_string(join->select_lex->type, + strlen(join->select_lex->type), default_charset_info)); if (tab->type == JT_ALL && tab->select && tab->select->quick) tab->type= JT_RANGE; @@ -7447,6 +7448,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) { + DBUG_ENTER("mysql_explain_union"); int res= 0; SELECT_LEX *first= unit->first_select(); for (SELECT_LEX *sl= first; @@ -7469,12 +7471,14 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) } if (res > 0) res= -res; // mysql_explain_select do not report error - return res; + DBUG_RETURN(res); } int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type, select_result *result) { + DBUG_ENTER("mysql_explain_select"); + DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, type)) select_lex->type= type; thd->lex.select= select_lex; SELECT_LEX_UNIT *unit= select_lex->master_unit(); @@ -7487,6 +7491,6 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type, (ORDER*) thd->lex.proc_list.first, select_lex->options | thd->options | SELECT_DESCRIBE, result, unit, select_lex, 0); - return res; + DBUG_RETURN(res); } diff --git a/sql/sql_select.h b/sql/sql_select.h index 7aa2e5da48a..c5b5357be50 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -290,7 +290,7 @@ class store_key :public Sql_alloc if (field_arg->type() == FIELD_TYPE_BLOB) to_field=new Field_varstring(ptr, length, (uchar*) null, 1, Field::NONE, field_arg->field_name, - field_arg->table, field_arg->binary(), default_charset_info); + field_arg->table, field_arg->charset()); else { to_field=field_arg->new_field(&thd->mem_root,field_arg->table); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index d2d14d4e7a2..457e555463d 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -521,12 +521,23 @@ int sortcmp(const String *x,const String *y) #endif /* USE_STRCOLL */ x_len-=len; // For easy end space test y_len-=len; - while (len--) + if (x->str_charset->sort_order) { - if (x->str_charset->sort_order[(uchar) *s++] != + while (len--) + { + if (x->str_charset->sort_order[(uchar) *s++] != x->str_charset->sort_order[(uchar) *t++]) - return ((int) x->str_charset->sort_order[(uchar) s[-1]] - - (int) x->str_charset->sort_order[(uchar) t[-1]]); + return ((int) x->str_charset->sort_order[(uchar) s[-1]] - + (int) x->str_charset->sort_order[(uchar) t[-1]]); + } + } + else + { + while (len--) + { + if (*s++ != *t++) + return ((int) s[-1] - (int) t[-1]); + } } #ifndef CMP_ENDSPACE /* Don't compare end space in strings */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bff07809861..5187351258e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -383,6 +383,12 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, it.rewind(); while ((sql_field=it++)) { + if(!sql_field->charset) + sql_field->charset = create_info->table_charset ? + create_info->table_charset : + thd->db_charset? thd->db_charset : + default_charset_info; + switch (sql_field->sql_type) { case FIELD_TYPE_BLOB: case FIELD_TYPE_MEDIUM_BLOB: @@ -391,7 +397,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, sql_field->pack_flag=FIELDFLAG_BLOB | pack_length_to_packflag(sql_field->pack_length - portable_sizeof_char_ptr); - if (sql_field->flags & BINARY_FLAG) + if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->length=8; // Unireg field length sql_field->unireg_check=Field::BLOB_FIELD; @@ -400,17 +406,21 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, case FIELD_TYPE_VAR_STRING: case FIELD_TYPE_STRING: sql_field->pack_flag=0; - if (sql_field->flags & BINARY_FLAG) + if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; break; case FIELD_TYPE_ENUM: sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) | FIELDFLAG_INTERVAL; + if (sql_field->charset->state & MY_CS_BINSORT) + sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->unireg_check=Field::INTERVAL_FIELD; break; case FIELD_TYPE_SET: sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) | FIELDFLAG_BITFIELD; + if (sql_field->charset->state & MY_CS_BINSORT) + sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->unireg_check=Field::BIT_FIELD; break; case FIELD_TYPE_DATE: // Rest of string types @@ -438,11 +448,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, sql_field->offset= pos; if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) auto_increment++; - if(!sql_field->charset) - sql_field->charset = create_info->table_charset ? - create_info->table_charset : - thd->db_charset? thd->db_charset : - default_charset_info; pos+=sql_field->pack_length; } if (auto_increment > 1) @@ -2018,16 +2023,24 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, #ifdef HAVE_BERKELEY_DB if (old_db_type == DB_TYPE_BERKELEY_DB) { - (void) berkeley_flush_logs(); /* For the alter table to be properly flushed to the logs, we have to open the new table. If not, we get a problem on server shutdown. */ - if (!open_tables(thd, table_list)) // Should always succeed + char path[FN_REFLEN]; + (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,table_name); + fn_format(path,path,"","",4); + table=open_temporary_table(thd, path, new_db, tmp_name,0); + if (table) { - close_thread_table(thd, &table_list->table); + intern_close_table(table); + my_free((char*) table, MYF(0)); } + else + sql_print_error("Warning: Could not open BDB table %s.%s after rename\n", + new_db,table_name); + (void) berkeley_flush_logs(); } #endif table_list->table=0; // For query cache diff --git a/sql/sql_union.cc b/sql/sql_union.cc index eaeec2c1e68..f1c80bf8546 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -110,7 +110,6 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result) DBUG_RETURN(0); prepared= 1; union_result=0; - describe=(first_select()->options & SELECT_DESCRIBE) ? 1 : 0; res= 0; found_rows_for_union= false; TMP_TABLE_PARAM tmp_table_param; @@ -122,30 +121,11 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result) if (((void*)(global_parameters)) == ((void*)this)) { found_rows_for_union= first_select()->options & OPTION_FOUND_ROWS && - !describe && global_parameters->select_limit; + global_parameters->select_limit; if (found_rows_for_union) first_select()->options ^= OPTION_FOUND_ROWS; } item_list.empty(); - if (describe) - { - Item *item; - item_list.push_back(new Item_empty_string("table",NAME_LEN)); - item_list.push_back(new Item_empty_string("type",10)); - item_list.push_back(item=new Item_empty_string("possible_keys", - NAME_LEN*MAX_KEY)); - item->maybe_null=1; - item_list.push_back(item=new Item_empty_string("key",NAME_LEN)); - item->maybe_null=1; - item_list.push_back(item=new Item_int("key_len",0,3)); - item->maybe_null=1; - item_list.push_back(item=new Item_empty_string("ref", - NAME_LEN*MAX_REF_PARTS)); - item->maybe_null=1; - item_list.push_back(new Item_real("rows",0.0,0,10)); - item_list.push_back(new Item_empty_string("Extra",255)); - } - else { Item *item; List_iterator<Item> it(first_select()->item_list); @@ -162,8 +142,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result) bzero((char*) &tmp_table_param,sizeof(tmp_table_param)); tmp_table_param.field_count=item_list.elements; if (!(table= create_tmp_table(thd, &tmp_table_param, item_list, - (ORDER*) 0, !describe & - !thd->lex.union_option, + (ORDER*) 0, !union_option, 1, 0, (first_select()->options | thd->options | TMP_TABLE_ALL_COLUMNS), @@ -179,7 +158,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result) if (!(union_result=new select_union(table))) goto err; - union_result->save_time_stamp=!describe; + union_result->save_time_stamp=1; union_result->tmp_table_param=&tmp_table_param; // prepare selects @@ -187,8 +166,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result) for (sl= first_select(); sl; sl= sl->next_select()) { JOIN *join= new JOIN(thd, sl->item_list, - sl->options | thd->options | SELECT_NO_UNLOCK | - ((describe) ? SELECT_DESCRIBE : 0), + sl->options | thd->options | SELECT_NO_UNLOCK, union_result); joins.push_back(new JOIN_P(join)); thd->lex.select=sl; @@ -220,11 +198,12 @@ err: int st_select_lex_unit::exec() { DBUG_ENTER("st_select_lex_unit::exec"); + SELECT_LEX *lex_select_save= thd->lex.select; + if(depended || !item || !item->assigned()) { if (optimized && item && item->assigned()) item->assigned(0); // We will reinit & rexecute unit - SELECT_LEX *lex_select_save= thd->lex.select; for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) { thd->lex.select=sl; @@ -236,27 +215,28 @@ int st_select_lex_unit::exec() sl->options&= ~OPTION_FOUND_ROWS; if (!optimized) - sl->join->optimize(); + res= sl->join->optimize(); else - sl->join->reinit(); - - sl->join->exec(); - res= sl->join->error; + res= sl->join->reinit(); + if (!res) + { + sl->join->exec(); + res= sl->join->error; + } if (res) { thd->lex.select= lex_select_save; DBUG_RETURN(res); } } - thd->lex.select= lex_select_save; optimized= 1; } if (union_result->flush()) { - res= 1; // Error is already sent - DBUG_RETURN(res); + thd->lex.select= lex_select_save; + DBUG_RETURN(1); } /* Send result to 'result' */ @@ -289,12 +269,8 @@ int st_select_lex_unit::exec() select_limit_cnt= HA_POS_ERROR; // no limit if (select_limit_cnt == HA_POS_ERROR) thd->options&= ~OPTION_FOUND_ROWS; - if (describe) - select_limit_cnt= HA_POS_ERROR; // no limit res= mysql_select(thd,&result_table_list, item_list, NULL, - (describe) ? - 0: (ORDER*)global_parameters->order_list.first, (ORDER*) NULL, NULL, (ORDER*) NULL, thd->options, result, this, first_select(), 1); @@ -303,6 +279,7 @@ int st_select_lex_unit::exec() } } thd->lex.select_lex.ftfunc_list= &thd->lex.select_lex.ftfunc_list_alloc; + thd->lex.select= lex_select_save; DBUG_RETURN(res); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index c146b07284f..e8d4af94640 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -445,7 +445,7 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u) else *int_ptr++=counter; } - if (!num_updated) + if (!num_updated--) { net_printf(thd, ER_NOT_SUPPORTED_YET, "SET CLAUSE MUST CONTAIN TABLE.FIELD REFERENCE"); DBUG_RETURN(1); @@ -455,11 +455,11 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u) Here, I have to allocate the array of temporary tables I have to treat a case of num_updated=1 differently in send_data() method. */ - if (num_updated > 1) + if (num_updated) { - tmp_tables = (TABLE **) sql_calloc(sizeof(TABLE *) * (num_updated - 1)); - infos = (COPY_INFO *) sql_calloc(sizeof(COPY_INFO) * (num_updated - 1)); - fields_by_tables = (List_item **)sql_calloc(sizeof(List_item *) * num_updated); + tmp_tables = (TABLE **) sql_calloc(sizeof(TABLE *) * num_updated); + infos = (COPY_INFO *) sql_calloc(sizeof(COPY_INFO) * num_updated); + fields_by_tables = (List_item **)sql_calloc(sizeof(List_item *) * (num_updated + 1)); unsigned int counter; List<Item> *temp_fields; for (table_ref=update_tables, counter = 0; table_ref; table_ref=table_ref->next) @@ -482,8 +482,7 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u) if (counter) { Field_string offset(table_ref->table->file->ref_length, false, - "offset", table_ref->table, true, - default_charset_info); + "offset", table_ref->table, my_charset_bin); temp_fields->push_front(new Item_field(((Field *)&offset))); // Make a temporary table @@ -556,7 +555,7 @@ multi_update::~multi_update() table->time_stamp=save_time_stamps[counter]; } if (tmp_tables) - for (uint counter = 0; counter < num_updated-1; counter++) + for (uint counter = 0; counter < num_updated; counter++) if (tmp_tables[counter]) free_tmp_table(thd,tmp_tables[counter]); } @@ -568,7 +567,7 @@ bool multi_update::send_data(List<Item> &values) for (uint counter = 0; counter < fields.elements; counter++) real_values.pop(); // We have skipped fields .... - if (num_updated == 1) + if (!num_updated) { for (table_being_updated=update_tables ; table_being_updated ; @@ -689,7 +688,7 @@ void multi_update::send_error(uint errcode,const char *err) if ((table_being_updated->table->file->has_transactions() && table_being_updated == update_tables) || !not_trans_safe) ha_rollback_stmt(thd); - else if (do_update && num_updated > 1) + else if (do_update && num_updated) VOID(do_updates(true)); } @@ -776,7 +775,7 @@ bool multi_update::send_eof() thd->proc_info="updating the reference tables"; /* Does updates for the last n - 1 tables, returns 0 if ok */ - int error = (num_updated > 1) ? do_updates(false) : 0; /* do_updates returns 0 if success */ + int error = (num_updated) ? do_updates(false) : 0; /* do_updates returns 0 if success */ /* reset used flags */ #ifndef NOT_USED diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bc9f3b21d35..f87a2a78fb4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -909,9 +909,14 @@ create_table_option: table_list->next=0; lex->create_info.used_fields|= HA_CREATE_USED_UNION; } - | CHARSET o_eq charset_name_or_default + | opt_default CHARSET o_eq charset_name_or_default { - Lex->create_info.table_charset= $3; + Lex->create_info.table_charset= $4; + Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; + } + | opt_default CHAR_SYM SET o_eq charset_name_or_default + { + Lex->create_info.table_charset= $5; Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; } | INSERT_METHOD o_eq merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;} @@ -1024,12 +1029,12 @@ type: | char opt_binary { Lex->length=(char*) "1"; $$=FIELD_TYPE_STRING; } | BINARY '(' NUM ')' { Lex->length=$3.str; - Lex->type|=BINARY_FLAG; + Lex->charset=my_charset_bin; $$=FIELD_TYPE_STRING; } | varchar '(' NUM ')' opt_binary { Lex->length=$3.str; $$=FIELD_TYPE_VAR_STRING; } | VARBINARY '(' NUM ')' { Lex->length=$3.str; - Lex->type|=BINARY_FLAG; + Lex->charset=my_charset_bin; $$=FIELD_TYPE_VAR_STRING; } | YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; Lex->length=$2; } | DATE_SYM { $$=FIELD_TYPE_DATE; } @@ -1038,17 +1043,17 @@ type: | TIMESTAMP '(' NUM ')' { Lex->length=$3.str; $$=FIELD_TYPE_TIMESTAMP; } | DATETIME { $$=FIELD_TYPE_DATETIME; } - | TINYBLOB { Lex->type|=BINARY_FLAG; + | TINYBLOB { Lex->charset=my_charset_bin; $$=FIELD_TYPE_TINY_BLOB; } - | BLOB_SYM { Lex->type|=BINARY_FLAG; + | BLOB_SYM { Lex->charset=my_charset_bin; $$=FIELD_TYPE_BLOB; } - | GEOMETRY_SYM { Lex->type|=BINARY_FLAG; + | GEOMETRY_SYM { Lex->charset=my_charset_bin; $$=FIELD_TYPE_GEOMETRY; } - | MEDIUMBLOB { Lex->type|=BINARY_FLAG; + | MEDIUMBLOB { Lex->charset=my_charset_bin; $$=FIELD_TYPE_MEDIUM_BLOB; } - | LONGBLOB { Lex->type|=BINARY_FLAG; + | LONGBLOB { Lex->charset=my_charset_bin; $$=FIELD_TYPE_LONG_BLOB; } - | LONG_SYM VARBINARY { Lex->type|=BINARY_FLAG; + | LONG_SYM VARBINARY { Lex->charset=my_charset_bin; $$=FIELD_TYPE_MEDIUM_BLOB; } | LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; } | TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; } @@ -1059,13 +1064,13 @@ type: { $$=FIELD_TYPE_DECIMAL;} | NUMERIC_SYM float_options field_options { $$=FIELD_TYPE_DECIMAL;} - | ENUM {Lex->interval_list.empty();} '(' string_list ')' + | ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary { LEX *lex=Lex; lex->interval=typelib(lex->interval_list); $$=FIELD_TYPE_ENUM; } - | SET { Lex->interval_list.empty();} '(' string_list ')' + | SET { Lex->interval_list.empty();} '(' string_list ')' opt_binary { LEX *lex=Lex; lex->interval=typelib(lex->interval_list); @@ -1170,13 +1175,18 @@ charset_name_or_default: charset_name { $$=$1; } | DEFAULT { $$=NULL; } ; +opt_default: + /* empty */ {} + | DEFAULT {}; + opt_db_default_character_set: - /* empty */ { $$=default_charset_info; } - | DEFAULT CHAR_SYM SET charset_name_or_default { $$=$4; }; + /* empty */ { $$=default_charset_info; } + | opt_default CHAR_SYM SET charset_name_or_default { $$=$4; } + | opt_default CHARSET charset_name_or_default { $$=$3; }; opt_binary: /* empty */ { Lex->charset=NULL; } - | BINARY { Lex->type|=BINARY_FLAG; Lex->charset=NULL; } + | BINARY { Lex->charset=my_charset_bin; } | CHAR_SYM SET charset_name { Lex->charset=$3; } ; references: @@ -1413,6 +1423,20 @@ opt_to: | AS {}; slave: + START_SYM SLAVE slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_START; + lex->type = 0; + } + | + 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; @@ -1839,7 +1863,7 @@ simple_expr: | MATCH ident_list_arg AGAINST '(' expr IN_SYM BOOLEAN_SYM MODE_SYM ')' { Select->ftfunc_list->push_back((Item_func_match *) ($$=new Item_func_match_bool(*$2,$5))); } - | BINARY expr %prec NEG { $$= new Item_func_binary($2); } + | BINARY expr %prec NEG { $$= new Item_func_set_collation($2,my_charset_bin); } | CAST_SYM '(' expr AS cast_type ')' { $$= create_func_cast($3, $5); } | CASE_SYM opt_expr WHEN_SYM when_list opt_else END { $$= new Item_func_case(* $4, $2, $5 ); } @@ -2961,7 +2985,7 @@ show_param: Lex->mi.pos = $12; Lex->mi.server_id = $16; } - | MASTER_SYM LOGS_SYM + | BINARY LOGS_SYM { Lex->sql_command = SQLCOM_SHOW_BINLOGS; } @@ -3281,7 +3305,7 @@ text_string: TEXT_STRING { $$= new String($1.str,$1.length,default_charset_info); } | HEX_NUM { - Item *tmp = new Item_varbinary($1.str,$1.length,default_charset_info); + Item *tmp = new Item_varbinary($1.str,$1.length); $$= tmp ? tmp->val_str((String*) 0) : (String*) 0; }; param_marker: @@ -3308,7 +3332,7 @@ literal: | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } | NULL_SYM { $$ = new Item_null(); Lex->next_state=STATE_OPERATOR_OR_IDENT;} - | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length,default_charset_info);} + | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; }; @@ -4126,7 +4150,7 @@ optional_order_or_limit: union_option: /* empty */ {} - | ALL {Lex->union_option=1;}; + | ALL {Select->master_unit()->union_option= 1;}; singleval_subselect: subselect_start singleval_subselect_init diff --git a/sql/table.cc b/sql/table.cc index 122cce160b6..6e2df849700 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -349,7 +349,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, uint pack_flag= uint2korr(strpos+6); uint interval_nr= (uint) strpos[10]; enum_field_types field_type; - CHARSET_INFO *charset; + CHARSET_INFO *charset=NULL; LEX_STRING comment; if (new_frm_ver == 2) @@ -384,6 +384,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, null_pos,null_bit, pack_flag, field_type, + charset, (Field::utype) MTYP_TYPENR((uint) strpos[8]), (interval_nr ? outparam->intervals+interval_nr-1 : diff --git a/sql/unireg.cc b/sql/unireg.cc index 344583b56f1..81310c4a863 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -572,6 +572,7 @@ static bool make_empty_rec(File file,enum db_type table_type, 1 << (null_count & 7), field->pack_flag, field->sql_type, + field->charset, field->unireg_check, field->interval, field->field_name, |