Merge mysql.com:/home/nick/mysql/repository/mysql-4.1

into mysql.com:/home/nick/mysql/mysql-4.1
This commit is contained in:
nick@mysql.com 2002-10-29 15:51:41 -07:00
commit c20b489167
101 changed files with 1531 additions and 464 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -205,8 +205,8 @@ typedef struct {
} COMMANDS;
static COMMANDS commands[] = {
{ "help", 'h', com_help, 0, "Display this help." },
{ "?", '?', com_help, 0, "Synonym for `help'." },
{ "help", 'h', com_help, 1, "Display this help." },
{ "?", '?', com_help, 1, "Synonym for `help'." },
{ "clear", 'c', com_clear, 0, "Clear command."},
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." },
@ -382,8 +382,9 @@ int main(int argc,char *argv[])
}
}
#endif
sprintf(buff,
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n");
sprintf(buff, "%s%s",
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n",
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
put_info(buff,INFO_INFO);
status.exit_status=read_lines(1); // read lines and execute them
if (opt_outfile)
@ -1322,31 +1323,154 @@ static int reconnect(void)
The different commands
***************************************************************************/
int mysql_real_query_for_lazy(const char *buf, int length)
{
for (uint retry=0;; retry++)
{
if (!mysql_real_query(&mysql,buf,length))
return 0;
uint error=put_info(mysql_error(&mysql),INFO_ERROR, mysql_errno(&mysql));
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1
|| status.batch)
return error;
if (reconnect())
return error;
}
}
int mysql_store_result_for_lazy(MYSQL_RES **result)
{
if ((*result=mysql_store_result(&mysql)))
return 0;
if (mysql_error(&mysql)[0])
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
return 0;
}
static int com_server_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)), char *help_arg)
{
MYSQL_ROW cur;
const char *server_cmd= buffer->ptr();
char cmd_buf[100];
if (help_arg[0]!='\'')
{
(void*)sprintf(cmd_buf,"help \'%s\';",help_arg);
server_cmd= cmd_buf;
}
char buff[16], time_buf[32];
MYSQL_RES *result;
ulong timer;
uint error= 0;
if (!status.batch)
{
old_buffer= *buffer;
old_buffer.copy();
}
if (!connected && reconnect())
return 1;
timer= start_timer();
error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd));
if (error)
return error;
error= mysql_store_result_for_lazy(&result);
if (error)
return error;
if (result)
{
int num_rows= mysql_num_rows(result);
if (num_rows==1)
{
if (!(cur= mysql_fetch_row(result)))
return -1;
init_pager();
if (cur[1][0]=='Y')
{
tee_fprintf(PAGER, "\nHelp topic \'%s\'\n", cur[0]);
tee_fprintf(PAGER, "%s\n", cur[2]);
tee_fprintf(PAGER, "For help on specific function please type 'help <function>' where function is one of next :\n%s\n", cur[3]);
}
else
{
tee_fprintf(PAGER, "\nName : \'%s\'\n\n", cur[0]);
tee_fprintf(PAGER, "Description : \n%s\n\n", cur[2]);
tee_fprintf(PAGER, "Examples : \n%s\n", cur[3]);
}
end_pager();
}
else if (num_rows>1)
{
put_info("\nMany help items for your request exist", INFO_INFO);
put_info("For more specific request please type 'help <item>' where item is one of next :", INFO_INFO);
init_pager();
char last_char= '_';
while ((cur= mysql_fetch_row(result))){
if (cur[1][0]!=last_char){
put_info("-------------------------------------------", INFO_INFO);
put_info(cur[1][0]=='Y' ?
"categories:" : "functions:", INFO_INFO);
put_info("-------------------------------------------", INFO_INFO);
}
last_char= cur[1][0];
tee_fprintf(PAGER, "%s\n", cur[0]);
}
tee_fprintf(PAGER, "\n");
end_pager();
}
else
{
put_info("\nNothing found\n", INFO_INFO);
}
}
mysql_free_result(result);
return error;
}
static int
com_help (String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
reg1 int i;
char * help_arg= strchr(line,' ');
put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info(" (Commands must appear first on line and end with ';')\n",
INFO_INFO);
for (i = 0; commands[i].name; i++)
if (help_arg)
{
if (commands[i].func)
tee_fprintf(stdout, "%s\t(\\%c)\t%s\n", commands[i].name,
commands[i].cmd_char, commands[i].doc);
return com_server_help(buffer,line,help_arg+1);
}
if (connected)
tee_fprintf(stdout,
else
{
put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
for (i = 0; commands[i].name; i++)
{
if (commands[i].func)
tee_fprintf(stdout, "%s\t(\\%c)\t%s\n", commands[i].name,
commands[i].cmd_char, commands[i].doc);
}
if (connected)
tee_fprintf(stdout,
"\nConnection id: %ld (Can be used with mysqladmin kill)\n\n",
mysql_thread_id(&mysql));
else
tee_fprintf(stdout, "Not connected! Reconnect with 'connect'!\n\n");
else
tee_fprintf(stdout, "Not connected! Reconnect with 'connect'!\n\n");
}
return 0;
}
@ -1411,23 +1535,14 @@ com_go(String *buffer,char *line __attribute__((unused)))
}
timer=start_timer();
for (uint retry=0;; retry++)
error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
if (error)
{
if (!mysql_real_query(&mysql,buffer->ptr(),buffer->length()))
break;
error=put_info(mysql_error(&mysql),INFO_ERROR, mysql_errno(&mysql));
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1
|| status.batch)
{
buffer->length(0); // Remove query on error
return error;
}
if (reconnect())
{
buffer->length(0); // Remove query on error
return error;
}
buffer->length(0); // Remove query on error
return error;
}
error=0;
buffer->length(0);
@ -1440,13 +1555,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
}
else
{
if (!(result=mysql_store_result(&mysql)))
{
if (mysql_error(&mysql)[0])
{
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
}
}
error= mysql_store_result_for_lazy(&result);
if (error)
return error;
}
if (verbose >= 3 || !opt_silent)
@ -2772,3 +2883,5 @@ void sql_element_free(void *ptr)
my_free((gptr) ptr,MYF(0));
}
#endif /* EMBEDDED_LIBRARY */

View File

@ -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);
}

View File

@ -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)

View File

@ -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 */

View File

@ -258,4 +258,5 @@
#define ER_SUBSELECT_NO_1_COL 1239
#define ER_SUBSELECT_NO_1_ROW 1240
#define ER_UNKNOWN_STMT_HANDLER 1241
#define ER_CORRUPT_HELP_DB 1242
#define ER_ERROR_MESSAGES 242

View File

@ -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"

View File

@ -102,6 +102,8 @@ que_node_t */
#include "que0que.h"
#include "row0sel.h"
#include <math.h>
#define YYSTYPE que_node_t*
/* #define __STDC__ */

View File

@ -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 */

View File

@ -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
};

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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,
&not_used))
{

View File

@ -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
};

View File

@ -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

View File

@ -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;

View File

@ -5,6 +5,9 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);
@ -204,4 +207,16 @@ date
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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -1,4 +1,5 @@
-- source include/have_bdb.inc
# test for bug reported by Mark Steele
drop table if exists t1;

View File

@ -1,6 +1,6 @@
select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);
@ -110,4 +110,8 @@ 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;

View File

@ -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 ;

View File

@ -52,11 +52,13 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysql_explain_log.sh \
mysqld_multi.sh \
mysql_tableinfo.sh \
mysqld_safe.sh
mysqld_safe.sh \
fill_func_tables.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \
mysqlaccess.conf \
mysqlbug
mysqlbug \
fill_func_tables.sql
pkgdata_DATA = make_binary_distribution
@ -76,7 +78,8 @@ CLEANFILES = @server_scripts@ \
mysql_find_rows \
mysqlhotcopy \
mysqldumpslow \
mysqld_multi
mysqld_multi \
fill_func_tables.sql
SUPERCLEANFILES = mysqlbug
@ -127,3 +130,8 @@ SUFFIXES = .sh
# Don't update the files from bitkeeper
%::SCCS/s.%
all: fill_func_tables.sql
fill_func_tables.sql: fill_func_tables ../Docs/manual.texi
./fill_func_tables < ../Docs/manual.texi > fill_func_tables.sql

234
scripts/fill_func_tables.sh Normal file
View File

@ -0,0 +1,234 @@
#!@PERL@
# fill_func_tables - parse ../Docs/manual.texi
# Original version by vva
my $cat_name= "";
my $func_name= "";
my $text= "";
my $example= "";
local $mode= "";
sub prepare_name
{
my ($a)= @_;
$a =~ s/(\@itemize \@bullet)/ /g;
$a =~ s/(\@end itemize)/ /g;
$a =~ s/(\@end multitable)/ /g;
$a =~ s/(\@end table)/ /g;
$a =~ s/(\@cindex(.*?)\n)/ /g;
$a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
$a =~ s/(\@node(.*?)\n)/ /g;
$a =~ s/(\@tab)/\t/g;
$a =~ s/\@item/ /g;
$a =~ s/\@code\{((.|\n)+?)\}/$1/go;
$a =~ s/\@strong\{(.+?)\}/$1/go;
$a =~ s/\@samp\{(.+?)\}/$1/go;
$a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
$a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
$a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
$a =~ s/\'/\'\'/g;
$a =~ s/\\/\\\\/g;
$a =~ s/\`/\`\`/g;
$a =~ s/\@table \@code/ /g;
$a =~ s/\(\)//g;
$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs; #$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3 $1/gxs;
$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs;#$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1 $2/gxs;
$a =~ s/((\w|\s)+)\((.+)\)/$1/gxs;
return $a;
}
sub prepare_text
{
my ($a)= @_;
$a =~ s/(\@itemize \@bullet)/ /g;
$a =~ s/(\@end itemize)/ /g;
$a =~ s/(\@end multitable)/ /g;
$a =~ s/(\@end table)/ /g;
$a =~ s/(\@cindex(.*?)\n)/ /g;
$a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
$a =~ s/(\@node(.*?)\n)/ /g;
$a =~ s/(\@tab)/\t/g;
$a =~ s/\@itemx/ /g;
$a =~ s/\@item/ /g;
$a =~ s/\@code\{((.|\n)+?)\}/$1/go;
$a =~ s/\@strong\{(.+?)\}/$1/go;
$a =~ s/\@samp\{(.+?)\}/$1/go;
$a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
$a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
$a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
$a =~ s/\'/\'\'/g;
$a =~ s/\\/\\\\/g;
$a =~ s/\`/\`\`/g;
$a =~ s/(\n*?)$//g;
$a =~ s/\n/\\n/g;
$a =~ s/\@table \@code/ /g;
return $a;
}
sub prepare_example
{
my ($a)= @_;
$a =~ s/\'/\'\'/g;
$a =~ s/\\/\\\\/g;
$a =~ s/\`/\`\`/g;
$a =~ s/(\n*?)$//g;
$a =~ s/\n/\\n/g;
return $a;
}
sub flush_all
{
my ($mode) = @_;
if ($mode eq ""){return;}
$func_name= prepare_name($func_name);
$text= prepare_text($text);
$example= prepare_example($example);
if ($func_name ne "" && $text ne "" && !($func_name =~ /[abcdefghikjlmnopqrstuvwxyz]/)){
print "INSERT INTO function (name,description,example) VALUES (";
print "'$func_name',";
print "'$text',";
print "'$example'";
print ");\n";
print "INSERT INTO function_category (cat_id,func_id) VALUES (\@cur_category,LAST_INSERT_ID());\n";
}
$func_name= "";
$text= "";
$example= "";
$mode= "";
}
sub new_category
{
my ($category)= @_;
$category= prepare_text($category);
print "INSERT INTO function_category_name (name) VALUES (\'$category\');\n";
print "SELECT \@cur_category:=LAST_INSERT_ID();\n";
}
print "INSERT INTO db (Host,DB,User,Select_priv) VALUES ('%','mysql_help','','Y');\n";
print "CREATE DATABASE mysql_help;\n";
print "USE mysql_help;\n";
print "DROP TABLE IF EXISTS function;\n";
print "CREATE TABLE function (";
print " func_id int unsigned not null auto_increment,";
print " name varchar(64) not null,";
print " url varchar(128) not null,";
print " description text not null,";
print " example text not null,";
print " min_args tinyint not null,";
print " max_args tinyint,";
print " date_created datetime not null,";
print " last_modified timestamp not null,";
print " primary key (func_id)";
print ") type=myisam;\n\n";
print "DROP TABLE IF EXISTS function_category_name;\n";
print "CREATE TABLE function_category_name (";
print " cat_id smallint unsigned not null auto_increment,";
print " name varchar(64) not null,";
print " url varchar(128) not null,";
print " date_created datetime not null,";
print " last_modified timestamp not null,";
print " primary key (cat_id)";
print ") type=myisam;\n\n";
print "DROP TABLE IF EXISTS function_category;\n";
print "CREATE TABLE function_category (";
print " cat_id smallint unsigned not null references function_category_name,";
print " func_id int unsigned not null references function,";
print " primary key (cat_id, func_id)";
print ") type=myisam;\n\n";
print "DELETE FROM function_category_name;\n";
print "DELETE FROM function_category;\n";
print "DELETE FROM function;\n";
print "SELECT \@cur_category:=null;\n\n";
my $in_section_6_3= 0;
for(<>)
{
if ($_=~/\@section Functions for Use in \@code{SELECT} and \@code{WHERE} Clauses/ &&
!$in_section_6_3){
$in_section_6_3= 1;
next;
}
if ($_=~/\@section/ && $in_section_6_3){
$in_section_6_3= 0;
next;
}
if (!$in_section_6_3) { next; }
my $c_name= "";
($c_name)=m|\@c for_mysql_help,(.+?)$|;
if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
($cat_name)= $c_name;
new_category($cat_name);
next;
}
($c_name)=m|\@subsubsection (.+?)$|;
if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
($cat_name)= $c_name;
new_category($cat_name);
next;
}
($c_name)=m|\@subsection (.+?)$|;
if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
($cat_name)= $c_name;
new_category($cat_name);
next;
}
($f_name)=m|\@findex (.+?)$|;
if (!($f_name eq "")){
flush_all($mode);
($func_name)= ($f_name);
$mode= "text";
next;
}
if ($_=~/\@example/ && ($mode eq "text")){
$mode= "example";
next;
}
if ($_=~/\@end example/ && ($mode eq "example")){
flush_all($mode);
next;
}
if ($mode eq "text") { $text .= $_; }
if ($mode eq "example") { $example .= $_; }
}
print "DELETE function_category_name ";
print "FROM function_category_name ";
print "LEFT JOIN function_category ON function_category.cat_id=function_category_name.cat_id ";
print "WHERE function_category.cat_id is null;"

View File

@ -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;
}
}

View File

@ -307,8 +307,8 @@ then
fi
echo "Installing all prepared tables"
if eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" << END_OF_DATA
if (
cat << END_OF_DATA
use mysql;
$c_d
$i_d
@ -325,6 +325,9 @@ $i_f
$c_t
$c_c
END_OF_DATA
cat fill_func_tables.sql
) | eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then
echo ""
if test "$IN_RPM" -eq 0

View File

@ -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

View File

@ -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;

View File

@ -84,7 +84,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
slave.cc sql_repl.cc sql_union.cc sql_derived.cc \
mini_client.cc mini_client_errors.c \
stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\
gstream.cc spatial.cc
gstream.cc spatial.cc sql_help.cc
gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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))

View File

@ -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(

View File

@ -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()
@ -827,23 +822,22 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{
if (!ref)
{
SELECT_LEX *sl=thd->lex.select->outer_select();
if ((ref= find_item_in_list(this, thd->lex.select->item_list,
REPORT_EXCEPT_NOT_FOUND)) ==
(sl ? REPORT_EXCEPT_NOT_FOUND : REPORT_ALL_ERRORS))) ==
(Item **)not_found_item)
{
/*
We can't find table field in table list of current select,
We can't find table field in table list of current select,
consequently we have to find it in outer subselect(s).
We can't join lists of outer & current select, because of scope
of view rules. For example if both tables (outer & current) have
field 'field' it is not mistake to refer to this field without
We can't join lists of outer & current select, because of scope
of view rules. For example if both tables (outer & current) have
field 'field' it is not mistake to refer to this field without
mention of table name, but if we join tables in one list it will
cause error ER_NON_UNIQ_ERROR in find_item_in_list.
*/
SELECT_LEX *last=0;
for (SELECT_LEX *sl= thd->lex.select->outer_select();
sl;
sl= sl->outer_select())
for ( ; sl ; sl= sl->outer_select())
if((ref= find_item_in_list(this, (last= sl)->item_list,
REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item)
@ -857,13 +851,14 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{
// Call to report error
find_item_in_list(this, thd->lex.select->item_list, REPORT_ALL_ERRORS);
ref=0;
return 1;
}
else
{
depended_from= last;
/*
Mark all selects from resolved to 1 before select where was
Mark all selects from resolved to 1 before select where was
found table as depended (of select where was found table)
*/
for (SELECT_LEX *s= thd->lex.select;
@ -872,9 +867,9 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
if( !s->depended )
{
// Select is depended of outer select
s->depended= s->master_unit()->depended= 1;
s->depended= s->master_unit()->depended= 1;
//Tables will be reopened many times
for (TABLE_LIST *tbl=
for (TABLE_LIST *tbl=
(TABLE_LIST*)s->table_list.first;
tbl;
tbl= tbl->next)
@ -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;
}

View File

@ -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;
@ -84,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); }
};
@ -361,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(); }

View File

@ -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;

View File

@ -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)
{

View File

@ -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;
}
@ -792,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++)
{
@ -803,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);
}
}
@ -850,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;
}
@ -940,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();
}
@ -948,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;
@ -1003,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;
}
@ -1047,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());
@ -1246,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;
@ -1267,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;
@ -2183,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,
@ -2197,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;
@ -2217,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;
}
@ -2370,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;
}
@ -2384,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));
}

View File

@ -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;
@ -1965,7 +1971,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);
}
@ -2040,7 +2046,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;
@ -2049,9 +2054,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;
}
@ -2074,7 +2078,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;
@ -2083,8 +2086,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();

View File

@ -395,7 +395,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"; }
};
@ -467,7 +467,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); }
};
@ -480,7 +484,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;
}
};

View File

@ -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

View File

@ -172,6 +172,7 @@ static SYMBOL symbols[] = {
{ "HANDLER", SYM(HANDLER_SYM),0,0},
{ "HASH", SYM(HASH_SYM),0,0},
{ "HEAP", SYM(HEAP_SYM),0,0},
{ "HELP", SYM(HELP),0,0},
{ "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0},
{ "HOUR", SYM(HOUR_SYM),0,0},
{ "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM),0,0},

View File

@ -516,7 +516,7 @@ class Rand_log_event: public Log_event
#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
@ -534,7 +534,7 @@ class Rand_log_event: public Log_event
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);

View File

@ -505,6 +505,7 @@ int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_table_types(THD *thd);
int mysqld_show_privileges(THD *thd);
int mysqld_show_column_types(THD *thd);
int mysqld_help (THD *thd, const char *text);
/* sql_prepare.cc */
int compare_prep_stmt(PREP_STMT *a, PREP_STMT *b, void *not_used);

View File

@ -2416,6 +2416,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;
thd->real_id=pthread_self(); // Keep purify happy
/* Start a new thread to handle connection */

View File

@ -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;
}

View File

@ -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:

View File

@ -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)
{

View File

@ -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

View File

@ -251,3 +251,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -245,3 +245,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -253,3 +253,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -243,3 +243,4 @@
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -247,3 +247,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -242,3 +242,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -245,3 +245,5 @@
"Key reference and table reference doesn't match",
"Subselect return more than 1 field",
"Subselect return more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -242,3 +242,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -244,3 +244,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -242,3 +242,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -244,3 +244,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -242,3 +242,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -244,3 +244,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -244,3 +244,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -246,3 +246,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -242,3 +242,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -246,3 +246,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -245,3 +245,5 @@
"Key reference and table reference doesn't match",
"Подзапрос возвращает более одного поля",
"Подзапрос возвращает более одной записи",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -238,3 +238,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -250,3 +250,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -243,3 +243,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -242,3 +242,5 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -247,3 +247,5 @@
"Key reference and table reference doesn't match",
"ðiÄÚÁÐÉÔ ÐÏ×ÅÒÔÁ¤ ÂiÌØÛ ÎiÖ 1 ÓÔÏ×ÂÅÃØ",
"ðiÄÚÁÐÉÔ ÐÏ×ÅÒÔÁ¤ ÂiÌØÛ ÎiÖ 1 ÚÁÐÉÓ",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",

View File

@ -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);

View File

@ -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); };

View File

@ -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);
}

View File

@ -896,7 +896,7 @@ 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->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)

View File

@ -499,8 +499,7 @@ 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 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;

View File

@ -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,

408
sql/sql_help.cc Normal file
View File

@ -0,0 +1,408 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#include "sql_select.h" // For select_describe
#include "sql_acl.h"
/***************************************************************************
** Get help on string
***************************************************************************/
MI_INFO *open_help_file(THD *thd, const char *name)
{
char path[FN_REFLEN];
(void) sprintf(path,"%s/mysql_help/%s",mysql_data_home,name);
MI_INFO *res= 0;
if (!(res= mi_open(path,O_RDONLY,HA_OPEN_WAIT_IF_LOCKED)))
{
send_error(thd,ER_CORRUPT_HELP_DB);
return 0;
}
mi_extra(res,HA_EXTRA_WAIT_LOCK,0);
return res;
}
#define size_hf_func_id 4 /* func_id int unsigned, */
#define size_hf_name 64 /* name varchar(64), */
#define size_hf_url 128 /* url varchar(128), */
#define size_hf_description sizeof(char*) /* description text, */
#define size_hf_example sizeof(char*) /* example text, */
#define size_hf_min_args 16 /* min_args tinyint, */
#define size_hf_max_args 16 /* max_args tinyint, */
#define size_hf_date_created 8 /* date_created datetime, */
#define size_hf_last_modified 8 /* last_modified timestamp, */
#define offset_hf_func_id 1
#define offset_hf_name (offset_hf_func_id+size_hf_func_id)
#define offset_hf_url (offset_hf_name+size_hf_name)
#define offset_hf_description (offset_hf_url+size_hf_url)
#define offset_hf_example (offset_hf_description+size_hf_description)
#define offset_hf_min_args (offset_hf_example+size_hf_example)
#define offset_hf_max_args (offset_hf_min_args+size_hf_min_args)
#define offset_hf_date_created (offset_hf_max_args+size_hf_max_args)
#define offset_hf_last_modified (offset_hf_date_created+size_hf_date_created)
#define HELP_LEAF_SIZE (offset_hf_last_modified+size_hf_last_modified)
class help_leaf{
public:
char record[HELP_LEAF_SIZE];
inline const char *get_name()
{
return &record[offset_hf_name];
}
inline const char *get_description()
{
return *((char**)&record[199/*offset_hf_description*/]);
}
inline const char *get_example()
{
return *((char**)&record[209/*offset_hf_example*/]);
}
void prepare_fields()
{
const char *name= get_name();
const char *c= name + size_hf_name - 1;
while (*c==' ') c--;
int len= c-name+1;
((char*)name)[len]= '\0';
}
};
int search_functions(MI_INFO *file_leafs, const char *mask,
List<String> *names,
String **name, String **description, String **example)
{
DBUG_ENTER("search_functions");
int count= 0;
if(mi_scan_init(file_leafs))
DBUG_RETURN(-1);
help_leaf leaf;
while (!mi_scan(file_leafs,(byte*)&leaf))
{
leaf.prepare_fields();
const char *lname= leaf.get_name();
if (wild_case_compare(system_charset_info,lname,mask))
continue;
count++;
if (count>2)
{
String *s= new String(lname,system_charset_info);
if (!s->copy())
names->push_back(s);
}
else if (count==1)
{
*description= new String(leaf.get_description(),system_charset_info);
*example= new String(leaf.get_example(),system_charset_info);
*name= new String(lname,system_charset_info);
(*description)->copy();
(*example)->copy();
(*name)->copy();
}
else
{
names->push_back(*name);
delete *description;
delete *example;
*name= 0;
*description= 0;
*example= 0;
String *s= new String(lname,system_charset_info);
if (!s->copy())
names->push_back(s);
}
}
DBUG_RETURN(count);
}
#define size_hc_cat_id 2 /* cat_id smallint, */
#define size_hc_name 64 /* name varchar(64), */
#define size_hc_url 128 /* url varchar(128), */
#define size_hc_date_created 8 /* date_created datetime, */
#define size_hc_last_modified 8 /* last_modified timestamp, */
#define offset_hc_cat_id 0
#define offset_hc_name (offset_hc_cat_id+size_hc_cat_id)
#define offset_hc_url (offset_hc_name+size_hc_name)
#define offset_hc_date_created (offset_hc_url+size_hc_url)
#define offset_hc_last_modified (offset_hc_date_created+size_hc_date_created)
#define HELP_CATEGORY_SIZE (offset_hc_last_modified+size_hc_last_modified)
class help_category{
public:
char record[HELP_CATEGORY_SIZE];
inline int16 get_cat_id()
{
return sint2korr(&record[offset_hc_cat_id]);
}
inline const char *get_name()
{
return &record[offset_hc_name];
}
void prepare_fields()
{
const char *name= get_name();
const char *c= name + size_hc_name - 1;
while (*c==' ') c--;
int len= c-name+1;
((char*)name)[len]= '\0';
}
};
int search_categories(THD *thd,
const char *mask, List<String> *names, int16 *res_id)
{
DBUG_ENTER("search_categories");
int count= 0;
MI_INFO *file_categories= 0;
if (!(file_categories= open_help_file(thd,"function_category_name")))
DBUG_RETURN(-1);
if(mi_scan_init(file_categories))
{
mi_close(file_categories);
DBUG_RETURN(-1);
}
help_category category;
while (!mi_scan(file_categories,(byte*)&category))
{
category.prepare_fields();
const char *lname= category.get_name();
if (mask && wild_case_compare(system_charset_info,lname,mask))
continue;
count++;
if (count==1 && res_id)
*res_id= category.get_cat_id();
String *s= new String(lname,system_charset_info);
if (!s->copy())
names->push_back(s);
}
mi_close(file_categories);
DBUG_RETURN(count);
}
int send_variant_2_list(THD *thd, List<String> *names, my_bool is_category)
{
DBUG_ENTER("send_names");
List_iterator<String> it(*names);
String *cur_name;
String *packet= &thd->packet;
while ((cur_name = it++))
{
packet->length(0);
net_store_data(packet, cur_name->ptr());
net_store_data(packet, is_category ? "Y" : "N");
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
DBUG_RETURN(-1);
}
DBUG_RETURN(0);
}
#define size_hcn_cat_id 2 /* cat_id smallint, */
#define size_hcn_func_id 4 /* func_id int, */
#define offset_hcn_cat_id 1
#define offset_hcn_func_id (offset_hcn_cat_id+size_hcn_cat_id)
#define HELP_CATEGORY_NAME_SIZE (offset_hcn_func_id + size_hcn_func_id)
class help_category_leaf{
public:
char record[HELP_CATEGORY_NAME_SIZE];
inline int16 get_cat_id()
{
return sint2korr(&record[offset_hcn_cat_id]);
}
inline int get_func_id()
{
return sint3korr(&record[offset_hcn_func_id]);
}
};
int get_all_names_for_category(THD *thd,MI_INFO *file_leafs,
int16 cat_id, List<String> *res)
{
DBUG_ENTER("get_all_names_for_category");
MI_INFO *file_names_categories= 0;
if (!(file_names_categories= open_help_file(thd,"function_category")))
DBUG_RETURN(1);
help_category_leaf cat_leaf;
help_leaf leaf;
int key_res= mi_rkey(file_names_categories, (byte*)&cat_leaf, 0,
(const byte*)&cat_id,2,HA_READ_KEY_EXACT);
while (!key_res && cat_leaf.get_cat_id()==cat_id)
{
int leaf_id= cat_leaf.get_func_id();
if (!mi_rkey(file_leafs, (byte*)&leaf, 0,
(const byte*)&leaf_id,4,HA_READ_KEY_EXACT))
{
leaf.prepare_fields();
String *s= new String(leaf.get_name(),system_charset_info);
if (!s->copy())
res->push_back(s);
}
key_res= mi_rnext(file_names_categories, (byte*)&cat_leaf, 0);
}
mi_close(file_names_categories);
DBUG_RETURN(0);
}
int send_answer_1(THD *thd, const char *s1, const char *s2,
const char *s3, const char *s4)
{
DBUG_ENTER("send_answer_1");
List<Item> field_list;
field_list.push_back(new Item_empty_string("name",64));
field_list.push_back(new Item_empty_string("is_category",1));
field_list.push_back(new Item_empty_string("description",1000));
field_list.push_back(new Item_empty_string("example",1000));
if (send_fields(thd,field_list,1))
DBUG_RETURN(1);
String *packet= &thd->packet;
packet->length(0);
net_store_data(packet, s1);
net_store_data(packet, s2);
net_store_data(packet, s3);
net_store_data(packet, s4);
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
DBUG_RETURN(-1);
DBUG_RETURN(0);
}
int send_header_2(THD *thd)
{
DBUG_ENTER("send_header2");
List<Item> field_list;
field_list.push_back(new Item_empty_string("name",64));
field_list.push_back(new Item_empty_string("is_category",1));
DBUG_RETURN(send_fields(thd,field_list,1));
}
int mysqld_help (THD *thd, const char *mask)
{
DBUG_ENTER("mysqld_help");
MI_INFO *file_leafs= 0;
if (!(file_leafs= open_help_file(thd,"function")))
DBUG_RETURN(1);
List<String> function_list, categories_list;
String *name, *description, *example;
int res;
int count= search_functions(file_leafs, mask,
&function_list,&name,&description,&example);
if (count<0)
{
res= 1;
goto end;
}
else if (count==0)
{
int16 category_id;
count= search_categories(thd, mask, &categories_list, &category_id);
if (count<0)
{
res= 1;
goto end;
}
else if (count==1)
{
if (res= get_all_names_for_category(thd, file_leafs,
category_id,&function_list))
goto end;
List_iterator<String> it(function_list);
String *cur_leaf, example;
while ((cur_leaf = it++))
{
example.append(*cur_leaf);
example.append("\n",1);
}
if (res= send_answer_1(thd, categories_list.head()->ptr(),
"Y","",example.ptr()))
goto end;
}
else
{
if ((res= send_header_2(thd)) ||
(count==0 &&
(search_categories(thd, 0, &categories_list, 0)<0 &&
(res= 1))) ||
(res= send_variant_2_list(thd,&categories_list,true)))
goto end;
}
}
else if (count==1)
{
if (res= send_answer_1(thd,name->ptr(),"N",
description->ptr(), example->ptr()))
goto end;
}
else if((res= send_header_2(thd)) ||
(res= send_variant_2_list(thd,&function_list,false)) ||
(search_categories(thd, mask, &categories_list, 0)<0 &&
(res=1)) ||
(res= send_variant_2_list(thd,&categories_list,true)))
{
goto end;
}
send_eof(thd);
end:
mi_close(file_leafs);
DBUG_RETURN(res);
}

View File

@ -944,7 +944,8 @@ void st_select_lex_unit::init_query()
global_parameters= this;
select_limit_cnt= HA_POS_ERROR;
offset_limit_cnt= 0;
prepared= optimized= 0;
union_option= 0;
prepared= optimized= executed= 0;
item= 0;
}

View File

@ -66,7 +66,7 @@ enum enum_sql_command {
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES,
SQLCOM_END
SQLCOM_END, SQLCOM_HELP
};
enum lex_states
@ -227,8 +227,9 @@ protected:
select_result *result;
int res;
bool describe, found_rows_for_union,
prepared, //prepare phase already performed for UNION (unit)
optimized; // optimize phase already performed for UNION (unit)
prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit)
executed; // already executed
public:
/*
Pointer to 'last' select or pointer to unit where stored
@ -240,6 +241,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 +375,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;
@ -381,6 +383,7 @@ typedef struct st_lex
bool derived_tables, describe;
uint slave_thd_opt;
CHARSET_INFO *charset;
char *help_arg;
} LEX;

View File

@ -1486,6 +1486,10 @@ mysql_execute_command(THD *thd)
send_ok(thd);
break;
case SQLCOM_HELP:
res= mysqld_help(thd,lex->help_arg);
break;
case SQLCOM_PURGE:
{
if (check_global_access(thd, SUPER_ACL))
@ -2904,7 +2908,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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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 */

View File

@ -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

View File

@ -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,16 @@ err:
int st_select_lex_unit::exec()
{
DBUG_ENTER("st_select_lex_unit::exec");
if(depended || !item || !item->assigned())
SELECT_LEX *lex_select_save= thd->lex.select;
if (executed && !depended)
DBUG_RETURN(0);
executed= 1;
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 +219,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 +273,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 +283,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);
}

View File

@ -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

View File

@ -505,6 +505,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SUBJECT_SYM
%token CIPHER_SYM
%token HELP
%left SET_VAR
%left OR_OR_CONCAT OR
%left AND
@ -637,7 +639,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild union union_list
precision union_option opt_on_delete_item subselect_start opt_and
subselect_end select_var_list select_var_list_init
subselect_end select_var_list select_var_list_init help
END_OF_INPUT
%type <NONE>
@ -699,7 +701,18 @@ verb_clause:
| handler
| unlock
| update
| use;
| use
| help;
/* help */
help:
HELP TEXT_STRING
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_HELP;
lex->help_arg= $2.str;
}
/* change master */
@ -1029,12 +1042,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; }
@ -1043,17 +1056,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; }
@ -1064,13 +1077,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);
@ -1186,7 +1199,7 @@ opt_db_default_character_set:
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:
@ -1863,7 +1876,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 ); }
@ -3305,7 +3318,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:
@ -3332,7 +3345,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; };
@ -4150,7 +4163,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

View File

@ -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 :

Some files were not shown because too many files have changed in this diff Show More