summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok2
-rwxr-xr-xBuild-tools/Bootstrap9
-rwxr-xr-xBuild-tools/Do-compile19
-rw-r--r--Build-tools/logger.pm15
-rwxr-xr-xBuild-tools/my_md5sum19
-rwxr-xr-xBuild-tools/mysql-copyright18
-rw-r--r--client/mysqltest.c89
-rw-r--r--configure.in6
-rw-r--r--include/config-win.h3
-rw-r--r--include/my_getopt.h17
-rw-r--r--include/my_global.h6
-rw-r--r--include/mysqld_error.h87
-rw-r--r--mysql-test/include/ps_create.inc14
-rw-r--r--mysql-test/include/ps_modify.inc32
-rw-r--r--mysql-test/include/ps_modify1.inc37
-rw-r--r--mysql-test/include/ps_query.inc35
-rw-r--r--mysql-test/mysql-test-run.sh4
-rw-r--r--mysql-test/ndb/ndbcluster.sh2
-rw-r--r--mysql-test/r/alter_table.result2
-rw-r--r--mysql-test/r/connect.result4
-rw-r--r--mysql-test/r/ctype_create.result42
-rw-r--r--mysql-test/r/ctype_recoding.result31
-rw-r--r--mysql-test/r/ctype_uca.result107
-rw-r--r--mysql-test/r/func_str.result6
-rw-r--r--mysql-test/r/grant.result1
-rw-r--r--mysql-test/r/grant2.result1
-rw-r--r--mysql-test/r/grant_cache.result1
-rw-r--r--mysql-test/r/multi_update.result2
-rw-r--r--mysql-test/r/ndb_index_ordered.result4
-rw-r--r--mysql-test/r/ps_2myisam.result12
-rw-r--r--mysql-test/r/ps_3innodb.result24
-rw-r--r--mysql-test/r/ps_5merge.result24
-rw-r--r--mysql-test/r/ps_6bdb.result12
-rw-r--r--mysql-test/r/rpl000001.result8
-rw-r--r--mysql-test/r/rpl_charset.result10
-rw-r--r--mysql-test/r/rpl_do_grant.result16
-rw-r--r--mysql-test/r/rpl_ignore_grant.result24
-rw-r--r--mysql-test/r/show_check.result8
-rw-r--r--mysql-test/r/system_mysql_db_refs.result56
-rw-r--r--mysql-test/t/alter_table.test2
-rw-r--r--mysql-test/t/connect.test4
-rw-r--r--mysql-test/t/ctype_create.test41
-rw-r--r--mysql-test/t/ctype_recoding.test29
-rw-r--r--mysql-test/t/ctype_uca.test1
-rw-r--r--mysql-test/t/func_str.test2
-rw-r--r--mysql-test/t/grant.test2
-rw-r--r--mysql-test/t/grant2.test2
-rw-r--r--mysql-test/t/grant_cache.test9
-rw-r--r--mysql-test/t/multi_update.test2
-rw-r--r--mysql-test/t/ndb_index_ordered.test2
-rw-r--r--mysql-test/t/ps_1general.test111
-rw-r--r--mysql-test/t/ps_2myisam.test4
-rw-r--r--mysql-test/t/ps_3innodb.test6
-rw-r--r--mysql-test/t/ps_4heap.test7
-rw-r--r--mysql-test/t/ps_5merge.test4
-rw-r--r--mysql-test/t/ps_6bdb.test4
-rw-r--r--mysql-test/t/rpl000001.test8
-rw-r--r--mysql-test/t/rpl_charset.test2
-rw-r--r--mysql-test/t/rpl_do_grant.test14
-rw-r--r--mysql-test/t/rpl_ignore_grant.test22
-rw-r--r--mysql-test/t/show_check.test9
-rw-r--r--mysql-test/t/system_mysql_db.test16
-rw-r--r--mysql-test/t/system_mysql_db_fix.test141
-rw-r--r--mysql-test/t/system_mysql_db_refs.test173
-rw-r--r--mysys/charset-def.c4
-rw-r--r--mysys/my_init.c1
-rw-r--r--mysys/my_lib.c11
-rw-r--r--ndb/include/util/ConfigValues.hpp8
-rw-r--r--ndb/src/common/util/ConfigValues.cpp44
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp2
-rw-r--r--ndb/src/kernel/vm/ArrayPool.hpp24
-rw-r--r--ndb/src/kernel/vm/DLFifoList.hpp4
-rw-r--r--ndb/src/kernel/vm/DLList.hpp4
-rw-r--r--ndb/src/kernel/vm/DataBuffer.hpp4
-rw-r--r--ndb/src/kernel/vm/SLList.hpp4
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp2
-rw-r--r--scripts/mysql_fix_privilege_tables.sh24
-rw-r--r--scripts/mysqlhotcopy.sh16
-rw-r--r--sql/examples/ha_archive.cc2
-rw-r--r--sql/examples/ha_archive.h2
-rw-r--r--sql/examples/ha_example.h8
-rw-r--r--sql/field.cc4
-rw-r--r--sql/field.h4
-rw-r--r--sql/ha_berkeley.cc29
-rw-r--r--sql/ha_berkeley.h9
-rw-r--r--sql/ha_heap.h2
-rw-r--r--sql/ha_innodb.h2
-rw-r--r--sql/ha_isam.h2
-rw-r--r--sql/ha_isammrg.h3
-rw-r--r--sql/ha_myisam.h6
-rw-r--r--sql/ha_myisammrg.h6
-rw-r--r--sql/ha_ndbcluster.cc3
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item_cmpfunc.cc9
-rw-r--r--sql/item_geofunc.cc8
-rw-r--r--sql/item_strfunc.cc37
-rw-r--r--sql/log.cc7
-rw-r--r--sql/log_event.cc47
-rw-r--r--sql/mysql_priv.h5
-rw-r--r--sql/mysqld.cc27
-rw-r--r--sql/opt_range.cc195
-rw-r--r--sql/opt_sum.cc13
-rw-r--r--sql/set_var.cc14
-rw-r--r--sql/share/charsets/Index.xml2
-rw-r--r--sql/share/charsets/armscii8.xml2
-rw-r--r--sql/share/czech/errmsg.txt1
-rw-r--r--sql/share/danish/errmsg.txt1
-rw-r--r--sql/share/dutch/errmsg.txt1
-rw-r--r--sql/share/english/errmsg.txt1
-rw-r--r--sql/share/estonian/errmsg.txt1
-rw-r--r--sql/share/french/errmsg.txt1
-rw-r--r--sql/share/german/errmsg.txt1
-rw-r--r--sql/share/greek/errmsg.txt1
-rw-r--r--sql/share/hungarian/errmsg.txt1
-rw-r--r--sql/share/italian/errmsg.txt1
-rw-r--r--sql/share/japanese/errmsg.txt3
-rw-r--r--sql/share/korean/errmsg.txt1
-rw-r--r--sql/share/norwegian-ny/errmsg.txt1
-rw-r--r--sql/share/norwegian/errmsg.txt1
-rw-r--r--sql/share/polish/errmsg.txt1
-rw-r--r--sql/share/portuguese/errmsg.txt1
-rw-r--r--sql/share/romanian/errmsg.txt1
-rw-r--r--sql/share/russian/errmsg.txt1
-rw-r--r--sql/share/serbian/errmsg.txt1
-rw-r--r--sql/share/slovak/errmsg.txt1
-rw-r--r--sql/share/spanish/errmsg.txt5
-rw-r--r--sql/share/swedish/errmsg.txt5
-rw-r--r--sql/share/ukrainian/errmsg.txt5
-rw-r--r--sql/sql_acl.cc5
-rw-r--r--sql/sql_class.cc14
-rw-r--r--sql/sql_db.cc266
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_select.cc14
-rw-r--r--sql/sql_show.cc10
-rw-r--r--sql/sql_table.cc17
-rw-r--r--sql/sql_update.cc5
-rw-r--r--sql/sql_yacc.yy20
-rw-r--r--sql/table.cc19
-rw-r--r--strings/ctype-uca.c58
-rw-r--r--vio/viosocket.c4
141 files changed, 1736 insertions, 764 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 802dc53452d..bd45ae65224 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -11,6 +11,7 @@ administrador@light.hegel.local
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
antony@ltantony.dsl-verizon.net
+antony@ltantony.rdg.cyberkinetica.com
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@bitbike.com
arjen@co3064164-a.bitbike.com
@@ -124,6 +125,7 @@ mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
mysqldev@build.mysql2.com
+mysqldev@melody.local
mysqldev@mysql.com
ndbdev@ndbmaster.mysql.com
nick@mysql.com
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index a46d83ca91c..fa3c6344a05 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -46,6 +46,7 @@ $opt_test= undef;
$opt_skip_check= undef;
$opt_skip_manual= undef;
$opt_win_dist= undef;
+$opt_quiet= undef;
$version= "unknown";
$major=$minor=$release=0;
@@ -67,7 +68,8 @@ GetOptions(
"suffix=s",
"test|t",
"verbose|v",
- "win-dist|w"
+ "win-dist|w",
+ "quiet|q",
) || print_help("");
#
@@ -99,8 +101,6 @@ if (defined $opt_build_command)
print_help("") if ($opt_help);
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
-$subject= "Bootstrap of $REPO failed" if $opt_mail;
-
&logger("Starting build");
&abort("The directory \"$REPO\" could not be found!") if (!-d $REPO);
&logger("Using $REPO as the BK parent repository");
@@ -306,7 +306,7 @@ if (!$opt_dry_run)
#
# Now build the source distribution
#
-&logger("Compiling");
+&logger("Compiling...");
$command= $build_command;
&run_command($command, "Compilation failed!");
@@ -403,6 +403,7 @@ Options:
include a log file snippet, if logging is enabled)
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
+-q, --quiet Be quiet
-p, --pull Update the source BK trees before building
-r, --revision=<rev> Export the tree as of revision <rev>
(default is up to the latest revision)
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index cf466ef5848..f47ae794b00 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -204,6 +204,17 @@ if ($opt_stage == 0)
safe_cd($host);
if ($opt_stage == 0 && ! $opt_use_old_distribution)
{
+ $md5_result= safe_system("./my_md5sum -c ${opt_distribution}.md5");
+
+ if ($md5_result != 0)
+ {
+ abort("MD5 failed for $opt_distribution!");
+ }
+ else
+ {
+ info("SUCCESS: MD5 checks for $opt_distribution");
+ }
+
safe_system("gunzip < $opt_distribution | $tar xf -");
# Fix file times; This is needed because the time for files may be
@@ -331,6 +342,9 @@ if ($opt_stage <= 3)
$tar_file=<$pwd/$host/mysql*.t*gz>;
abort ("Could not find tarball!") unless ($tar_file);
+# Generate the MD5 for the binary distribution
+safe_system("./my_md5sum $tar_file > ${tar_file}.md5}");
+
#
# Unpack the binary distribution
#
@@ -660,7 +674,10 @@ sub safe_system
my($com,$res)=@_;
print LOG "$com\n";
print "$host: $com\n" if ($opt_debug);
- system("$com >> $log 2>&1") && abort("error: Couldn't execute command, error: " . ($? / 256));
+ my $result= system("$com >> $log 2>&1");
+ abort("error: Couldn't execute command, error: " . ($? / 256)) unless $result == 0;
+
+ return $result;
}
sub check_system
diff --git a/Build-tools/logger.pm b/Build-tools/logger.pm
index 835d8014aa0..d3fb4c9db2f 100644
--- a/Build-tools/logger.pm
+++ b/Build-tools/logger.pm
@@ -5,7 +5,10 @@
#
sub logger
{
- my $message=$_[0];
+ my $message= $_[0];
+ my $cmnd= $_[1];
+
+ print $message . "\n" if !$opt_quiet && !$opt_verbose && !$cmnd;
print timestamp() . " " . $message . "\n" if $opt_verbose;
if (defined $opt_log && !$opt_dry_run)
{
@@ -30,9 +33,12 @@ sub run_command
}
else
{
- &logger($command);
- $command.= " >> $LOGFILE 2>&1" if defined $opt_log;
- $command.= " > /dev/null" if (!$opt_verbose && !$opt_log);
+ &logger($command, 1);
+
+ $command.= ';' unless ($command =~ m/^.*;$/);
+
+ $command =~ s/;/ >> $LOGFILE 2>&1;/g if defined $opt_log;
+ $command =~ s/;/ > \/dev\/null;/g if (!$opt_verbose && !$opt_log);
system($command) == 0 or &abort("$errormsg\n");
}
}
@@ -47,6 +53,7 @@ sub abort
{
my $message= $_[0];
my $messagefile;
+ my $subject= "Bootstrap of $REPO failed" if $opt_mail;
$message= "ERROR: " . $message;
&logger($message);
diff --git a/Build-tools/my_md5sum b/Build-tools/my_md5sum
index 20742ee2ed0..f4ac2f7d674 100755
--- a/Build-tools/my_md5sum
+++ b/Build-tools/my_md5sum
@@ -10,10 +10,22 @@
# Written by Matt Wagner <matt@mysql.com>
#
use strict;
+
+#
+# Use local perl libraries first. 'unshift' adds to the front of @INC
+# The local perl library dir hidden is $HOME/.perllibs on each build host
+#
+BEGIN
+{
+ my $homedir= $ENV{HOME};
+ unshift (@INC, "$homedir/.perllibs");
+}
+
use Digest::MD5;
use Getopt::Long;
-my $VER= "1.1";
+my $VER= "1.3";
+my $EXIT= 0;
#
# Strip the leading path info off the program name ($0). We want 'my_md5sum'
@@ -67,6 +79,9 @@ if ($opt_check)
# Print an error message if they don't match, else print OK
print "$checkfile: FAILED\n" if $digest ne $checksum;
print "$checkfile: OK\n" if $digest eq $checksum;
+
+ # Set the exit() status to non-zero if FAILED
+ $EXIT= 1 if $digest ne $checksum;
}
}
# Else generate the MD5 digest to STDOUT
@@ -80,6 +95,8 @@ else
}
}
+exit($EXIT);
+
#
# This routine generates the MD5 digest of a file
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright
index f2da3cdf447..e1ee513e06d 100755
--- a/Build-tools/mysql-copyright
+++ b/Build-tools/mysql-copyright
@@ -162,7 +162,23 @@ sub trim_the_fat
undef $/;
my $configure= <CONFIGURE>;
close(CONFIGURE);
- $configure=~ s|${the_fat}/Makefile dnl\n?||g;
+
+ #
+ # If $the_fat Makefile line closes the parenthesis, then
+ # replace that line with just the closing parenthesis.
+ #
+ if ($configure=~ m|${the_fat}/Makefile\)\n?|)
+ {
+ $configure=~ s|${the_fat}/Makefile(\)\n?)|$1|;
+ }
+ #
+ # Else just delete the line
+ #
+ else
+ {
+ $configure=~ s|${the_fat}/Makefile dnl\n?||;
+ }
+
open(CONFIGURE,">configure.in") or die "Unable to open configure.in for write: $!\n";
print CONFIGURE $configure;
close(CONFIGURE);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 5ba4ad7336c..8307fe44bd9 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -224,7 +224,6 @@ Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG,
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER,
Q_WAIT_FOR_SLAVE_TO_STOP,
-Q_REQUIRE_VERSION, Q_REQUIRE_OS,
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
Q_ENABLE_INFO, Q_DISABLE_INFO,
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
@@ -297,8 +296,6 @@ const char *command_names[]=
"server_stop",
"require_manager",
"wait_for_slave_to_stop",
- "require_version",
- "require_os",
"enable_warnings",
"disable_warnings",
"enable_info",
@@ -818,63 +815,6 @@ int do_server_op(struct st_query* q,const char* op)
}
#endif
-int do_require_version(struct st_query* q)
-{
- MYSQL* mysql = &cur_con->mysql;
- MYSQL_RES* res;
- MYSQL_ROW row;
- char* p=q->first_argument, *ver_arg;
- uint ver_arg_len,ver_len;
- LINT_INIT(res);
-
- if (!*p)
- die("Missing version argument in require_version\n");
- ver_arg = p;
- while (*p && !my_isspace(charset_info,*p))
- p++;
- *p = 0;
- ver_arg_len = p - ver_arg;
-
- if (mysql_query(mysql, "select version()") ||
- !(res=mysql_store_result(mysql)))
- die("Query failed while check server version: %s",
- mysql_error(mysql));
- if (!(row=mysql_fetch_row(res)) || !row[0])
- {
- mysql_free_result(res);
- die("Strange result from query while checking version");
- }
- ver_len = strlen(row[0]);
- if (ver_len < ver_arg_len || memcmp(row[0],ver_arg,ver_arg_len))
- {
- mysql_free_result(res);
- abort_not_supported_test();
- }
- mysql_free_result(res);
- return 0;
-}
-
-int do_require_os(struct st_query* q)
-{
- char *p=q->first_argument, *os_arg;
- DBUG_ENTER("do_require_os");
-
- if (!*p)
- die("Missing version argument in require_os\n");
- os_arg= p;
- while (*p && !my_isspace(charset_info,*p))
- p++;
- *p = 0;
-
- if (strcmp(os_arg, "unix"))
- die("For now only testing of os=unix is implemented\n");
-
-#if defined(__NETWARE__) || defined(__WIN__) || defined(__OS2__)
- abort_not_supported_test();
-#endif
- DBUG_RETURN(0);
-}
-
int do_source(struct st_query* q)
{
char* p=q->first_argument, *name;
@@ -1628,6 +1568,7 @@ int do_connect(struct st_query* q)
if (opt_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
+ mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, "latin1");
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
@@ -1910,12 +1851,6 @@ int read_query(struct st_query** q_ptr)
q->record_file[0]= 0;
q->require_file= 0;
q->first_word_len= 0;
- memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
- sizeof(global_expected_errno));
- q->expected_errors= global_expected_errors;
- q->abort_on_error= global_expected_errors == 0;
- bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
- global_expected_errors=0;
q->type = Q_UNKNOWN;
q->query_buf= q->query= 0;
@@ -1928,8 +1863,16 @@ int read_query(struct st_query** q_ptr)
if (*p == '#')
{
q->type = Q_COMMENT;
+ /* This goto is to avoid losing the "expected error" info. */
+ goto end;
}
- else if (p[0] == '-' && p[1] == '-')
+ memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
+ sizeof(global_expected_errno));
+ q->expected_errors= global_expected_errors;
+ q->abort_on_error= global_expected_errors == 0;
+ bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
+ global_expected_errors=0;
+ if (p[0] == '-' && p[1] == '-')
{
q->type= Q_COMMENT_WITH_COMMAND;
p+= 2; /* To calculate first word */
@@ -1964,6 +1907,8 @@ int read_query(struct st_query** q_ptr)
*p1 = 0;
}
}
+
+end:
while (*p && my_isspace(charset_info, *p))
p++;
if (!(q->query_buf= q->query= my_strdup(p, MYF(MY_WME))))
@@ -2692,6 +2637,8 @@ int main(int argc, char **argv)
if (opt_compress)
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
+ mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME, "latin1");
+
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
@@ -2729,15 +2676,13 @@ int main(int argc, char **argv)
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
- case Q_ENABLE_INFO: disable_info=0; break;
- case Q_DISABLE_INFO: disable_info=1; break;
+ case Q_ENABLE_INFO: disable_info=0; break;
+ case Q_DISABLE_INFO: disable_info=1; break;
case Q_ENABLE_METADATA: display_metadata=1; break;
- case Q_DISABLE_METADATA: display_metadata=0; break;
+ case Q_DISABLE_METADATA: display_metadata=0; break;
case Q_SOURCE: do_source(q); break;
case Q_SLEEP: do_sleep(q, 0); break;
case Q_REAL_SLEEP: do_sleep(q, 1); break;
- case Q_REQUIRE_VERSION: do_require_version(q); break;
- case Q_REQUIRE_OS: do_require_os(q); break;
case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(q); break;
case Q_REQUIRE_MANAGER: do_require_manager(q); break;
#ifndef EMBEDDED_LIBRARY
diff --git a/configure.in b/configure.in
index 8abd0a0908c..9ac4aaedfbe 100644
--- a/configure.in
+++ b/configure.in
@@ -521,7 +521,7 @@ fi
AC_SUBST(CHECK_PID)
AC_MSG_RESULT("$CHECK_PID")
-# We need a ANSI C compiler
+# We need an ANSI C compiler
AM_PROG_CC_STDC
# We need an assembler, too
@@ -529,7 +529,7 @@ AM_PROG_AS
if test "$am_cv_prog_cc_stdc" = "no"
then
- AC_MSG_ERROR([MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
+ AC_MSG_ERROR([MySQL requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
fi
NOINST_LDFLAGS=
@@ -2527,7 +2527,7 @@ done
case $default_charset in
armscii8)
default_charset_default_collation="armscii8_general_ci"
- default_charset_collations="armscii8_general_ci armscii_bin"
+ default_charset_collations="armscii8_general_ci armscii8_bin"
;;
ascii)
default_charset_default_collation="ascii_general_ci"
diff --git a/include/config-win.h b/include/config-win.h
index 0298c9012ce..91697c985d1 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -348,6 +348,9 @@ inline double ulonglong2double(ulonglong value)
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
+#define HAVE_SPATIAL 1
+#define HAVE_RTREE_KEYS 1
+
/* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 5f4025efa0e..bf119892a31 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -16,10 +16,17 @@
C_MODE_START
-enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
- GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC,
- GET_DISABLED
- };
+#define GET_NO_ARG 1
+#define GET_BOOL 2
+#define GET_INT 3
+#define GET_UINT 4
+#define GET_LONG 5
+#define GET_ULONG 6
+#define GET_LL 7
+#define GET_ULL 8
+#define GET_STR 9
+#define GET_STR_ALLOC 10
+#define GET_DISABLED 11
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
@@ -34,7 +41,7 @@ struct my_option
gptr *value; /* The variable value */
gptr *u_max_value; /* The user def. max variable value */
const char **str_values; /* Pointer to possible values */
- enum get_opt_var_type var_type;
+ ulong var_type;
enum get_opt_arg_type arg_type;
longlong def_value; /* Default value */
longlong min_value; /* Min allowed value */
diff --git a/include/my_global.h b/include/my_global.h
index 6490a775e7c..df42a91a739 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -213,7 +213,11 @@ C_MODE_END
/* Fix problem when linking c++ programs with gcc 3.x */
#ifdef DEFINE_CXA_PURE_VIRTUAL
-#define FIX_GCC_LINKING_PROBLEM extern "C" { int __cxa_pure_virtual() {return 0;} }
+#define FIX_GCC_LINKING_PROBLEM \
+extern "C" { int __cxa_pure_virtual() {\
+ DBUG_ASSERT("Pure virtual method called." == "Aborted");\
+ return 0;\
+} }
#else
#define FIX_GCC_LINKING_PROBLEM
#endif
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index 840b9c7f42a..d4848150c3f 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -316,46 +316,47 @@
#define ER_GET_TEMPORARY_ERRMSG 1297
#define ER_UNKNOWN_TIME_ZONE 1298
#define ER_WARN_INVALID_TIMESTAMP 1299
-#define ER_SP_NO_RECURSIVE_CREATE 1300
-#define ER_SP_ALREADY_EXISTS 1301
-#define ER_SP_DOES_NOT_EXIST 1302
-#define ER_SP_DROP_FAILED 1303
-#define ER_SP_STORE_FAILED 1304
-#define ER_SP_LILABEL_MISMATCH 1305
-#define ER_SP_LABEL_REDEFINE 1306
-#define ER_SP_LABEL_MISMATCH 1307
-#define ER_SP_UNINIT_VAR 1308
-#define ER_SP_BADSELECT 1309
-#define ER_SP_BADRETURN 1310
-#define ER_SP_BADSTATEMENT 1311
-#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1312
-#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1313
-#define ER_QUERY_INTERRUPTED 1314
-#define ER_SP_WRONG_NO_OF_ARGS 1315
-#define ER_SP_COND_MISMATCH 1316
-#define ER_SP_NORETURN 1317
-#define ER_SP_NORETURNEND 1318
-#define ER_SP_BAD_CURSOR_QUERY 1319
-#define ER_SP_BAD_CURSOR_SELECT 1320
-#define ER_SP_CURSOR_MISMATCH 1321
-#define ER_SP_CURSOR_ALREADY_OPEN 1322
-#define ER_SP_CURSOR_NOT_OPEN 1323
-#define ER_SP_UNDECLARED_VAR 1324
-#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1325
-#define ER_SP_FETCH_NO_DATA 1326
-#define ER_SP_DUP_PARAM 1327
-#define ER_SP_DUP_VAR 1328
-#define ER_SP_DUP_COND 1329
-#define ER_SP_DUP_CURS 1330
-#define ER_SP_CANT_ALTER 1331
-#define ER_SP_SUBSELECT_NYI 1332
-#define ER_SP_NO_USE 1333
-#define ER_SP_VARCOND_AFTER_CURSHNDLR 1334
-#define ER_SP_CURSOR_AFTER_HANDLER 1335
-#define ER_SP_CASE_NOT_FOUND 1336
-#define ER_FPARSER_TOO_BIG_FILE 1337
-#define ER_FPARSER_BAD_HEADER 1338
-#define ER_FPARSER_EOF_IN_COMMENT 1339
-#define ER_FPARSER_ERROR_IN_PARAMETER 1340
-#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1341
-#define ER_ERROR_MESSAGES 342
+#define ER_INVALID_CHARACTER_STRING 1300
+#define ER_SP_NO_RECURSIVE_CREATE 1301
+#define ER_SP_ALREADY_EXISTS 1302
+#define ER_SP_DOES_NOT_EXIST 1303
+#define ER_SP_DROP_FAILED 1304
+#define ER_SP_STORE_FAILED 1305
+#define ER_SP_LILABEL_MISMATCH 1306
+#define ER_SP_LABEL_REDEFINE 1307
+#define ER_SP_LABEL_MISMATCH 1308
+#define ER_SP_UNINIT_VAR 1309
+#define ER_SP_BADSELECT 1310
+#define ER_SP_BADRETURN 1311
+#define ER_SP_BADSTATEMENT 1312
+#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1313
+#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1314
+#define ER_QUERY_INTERRUPTED 1315
+#define ER_SP_WRONG_NO_OF_ARGS 1316
+#define ER_SP_COND_MISMATCH 1317
+#define ER_SP_NORETURN 1318
+#define ER_SP_NORETURNEND 1319
+#define ER_SP_BAD_CURSOR_QUERY 1320
+#define ER_SP_BAD_CURSOR_SELECT 1321
+#define ER_SP_CURSOR_MISMATCH 1322
+#define ER_SP_CURSOR_ALREADY_OPEN 1323
+#define ER_SP_CURSOR_NOT_OPEN 1324
+#define ER_SP_UNDECLARED_VAR 1325
+#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1326
+#define ER_SP_FETCH_NO_DATA 1327
+#define ER_SP_DUP_PARAM 1328
+#define ER_SP_DUP_VAR 1329
+#define ER_SP_DUP_COND 1330
+#define ER_SP_DUP_CURS 1331
+#define ER_SP_CANT_ALTER 1332
+#define ER_SP_SUBSELECT_NYI 1333
+#define ER_SP_NO_USE 1334
+#define ER_SP_VARCOND_AFTER_CURSHNDLR 1335
+#define ER_SP_CURSOR_AFTER_HANDLER 1336
+#define ER_SP_CASE_NOT_FOUND 1337
+#define ER_FPARSER_TOO_BIG_FILE 1338
+#define ER_FPARSER_BAD_HEADER 1339
+#define ER_FPARSER_EOF_IN_COMMENT 1340
+#define ER_FPARSER_ERROR_IN_PARAMETER 1341
+#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1342
+#define ER_ERROR_MESSAGES 343
diff --git a/mysql-test/include/ps_create.inc b/mysql-test/include/ps_create.inc
index 7c457572d61..77844c99d77 100644
--- a/mysql-test/include/ps_create.inc
+++ b/mysql-test/include/ps_create.inc
@@ -1,9 +1,23 @@
############### include/ps_create.inc ##################
# #
# drop + create the tables used in most PS test cases #
+# t/ps_*.test #
# #
########################################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TABLES HERE !!!
+#
+# Please be aware, that this file will be sourced by several
+# test case files stored within the subdirectory 't'.
+# So every change here will affect several test cases.
+
+#----------- Please insert your table definitions here ----------#
+
+
+#---- Please do not alter the following table definitions -------#
+
--disable_warnings
drop table if exists t1, t_many_col_types ;
--enable_warnings
diff --git a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc
index 85e9690cf04..04c5cbaad6b 100644
--- a/mysql-test/include/ps_modify.inc
+++ b/mysql-test/include/ps_modify.inc
@@ -4,6 +4,38 @@
# #
##############################################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+#
+# Please do not modify the structure (DROP/ALTER..) of the tables
+# 't1' and 't_many_col_types'.
+#
+# But you are encouraged to use these two tables within your statements
+# whenever possible.
+# t1 - very simple table
+# t_many_col_types - table with nearly all available column types
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable '$type' .
+
+
+
+#------------------- Please insert your test cases here -------------------#
+
+
+
+#-------- Please be very carefull when editing behind this line ----------#
+
--disable_query_log
select '------ delete tests ------' as test_sequence ;
--enable_query_log
diff --git a/mysql-test/include/ps_modify1.inc b/mysql-test/include/ps_modify1.inc
index 3608e726648..0b192a52625 100644
--- a/mysql-test/include/ps_modify1.inc
+++ b/mysql-test/include/ps_modify1.inc
@@ -4,6 +4,43 @@
# #
##############################################################
+#
+# NOTE: THESE TESTS CANNOT BE APPLIED TO TABLES OF TYPE MERGE.
+# Test which can be applied to MERGE tables should be stored in
+# include/ps_modify.inc .
+#
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+#
+# Please do not modify the structure (DROP/ALTER..) of the tables
+# 't1' and 't_many_col_types'.
+#
+# But you are encouraged to use these two tables within your statements
+# (DELETE/UPDATE/...) whenever possible.
+# t1 - very simple table
+# t_many_col_types - table with nearly all available column types
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable '$type' .
+
+
+
+#------------------- Please insert your test cases here -------------------#
+
+
+#-------- Please be very carefull when editing behind this line ----------#
+
## big insert select statements
set @duplicate='duplicate ' ;
set @1000=1000 ;
diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc
index 819ec4add06..e22f168dcd7 100644
--- a/mysql-test/include/ps_query.inc
+++ b/mysql-test/include/ps_query.inc
@@ -4,10 +4,39 @@
# #
##############################################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
-# Please do not modify (INSERT/UPDATE/DELETE) the content of the tables
-# t1 and t_many_col_types.
-# Such tests should be done in include/ps_modify.inc
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+#
+# Please do not modify (INSERT/UPDATE/DELETE) the content or the
+# structure (DROP/ALTER..) of the tables
+# 't1' and 't_many_col_types'.
+# Such tests should be done in include/ps_modify.inc .
+#
+# But you are encouraged to use these two tables within your SELECT statements
+# whenever possible.
+# t1 - very simple table
+# t_many_col_types - table with nearly all available column types
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable '$type' .
+
+
+
+#------------------- Please insert your test cases here -------------------#
+
+
+
+#-------- Please be very carefull when editing behind this line ----------#
--disable_query_log
select '------ simple select tests ------' as test_sequence ;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 52938c8a2ee..811d56ba6fe 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -370,7 +370,7 @@ while test $# -gt 0; do
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://developer.kde.org/~sewardj ."
exit 1
fi
- VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16"
+ VALGRIND="$VALGRIND --tool=memcheck --alignment=8 --leak-check=yes --num-callers=16"
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
SLEEP_TIME_AFTER_RESTART=10
@@ -525,7 +525,7 @@ fi
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
-MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose=1"
+MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index e51f6f6b076..4afbe5cf3d7 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -98,7 +98,7 @@ if [ ! -x $exec_ndb ]; then
echo "$exec_ndb missing"
exit 1
fi
-if [ ! -x $exec_mgmtsrv ]; then
+if [ ! -x $exec_mgmtsrvr ]; then
echo "$exec_mgmtsrvr missing"
exit 1
fi
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 1441b3c3600..5d50a3da666 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -123,7 +123,7 @@ grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2;
ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
create table t1 (n1 int not null, n2 int, n3 int, n4 float,
unique(n1),
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index b51a0a57ac0..e0a6c0cd141 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -40,7 +40,7 @@ time_zone_transition_type
user
show tables;
Tables_in_test
-update mysql.user set password=old_password("gambling2") where user="test";
+update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
set password=old_password('gambling3');
show tables;
@@ -63,5 +63,5 @@ time_zone_transition_type
user
show tables;
Tables_in_test
-delete from mysql.user where user="test";
+delete from mysql.user where user=_binary"test";
flush privileges;
diff --git a/mysql-test/r/ctype_create.result b/mysql-test/r/ctype_create.result
index e2dc8c1be66..0da76c556e2 100644
--- a/mysql-test/r/ctype_create.result
+++ b/mysql-test/r/ctype_create.result
@@ -1,15 +1,37 @@
SET @@character_set_server=latin5;
-CREATE DATABASE db1 DEFAULT CHARACTER SET cp1251;
-USE db1;
-CREATE DATABASE db2;
-SHOW CREATE DATABASE db1;
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
+USE mysqltest1;
+CREATE DATABASE mysqltest2;
+SHOW CREATE DATABASE mysqltest1;
Database Create Database
-db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET cp1251 */
-SHOW CREATE DATABASE db2;
+mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp1251 */
+SHOW CREATE DATABASE mysqltest2;
Database Create Database
-db2 CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET latin5 */
-DROP DATABASE db2;
-USE db1;
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin5 */
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin5
+DROP TABLE mysqltest2.t1;
+ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin7
+DROP DATABASE mysqltest2;
+CREATE DATABASE mysqltest2 CHARACTER SET latin2;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+DROP DATABASE mysqltest2;
+USE mysqltest1;
CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
Table Create Table
@@ -32,4 +54,4 @@ t1 CREATE TABLE `t1` (
`a` char(10) collate latin1_german1_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
DROP TABLE t1;
-DROP DATABASE db1;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index ed59de87395..805f731f0ec 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -111,3 +111,34 @@ SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');
hex('ÔÅÓÔ')
F2E5F1F2
+USE test;
+SET NAMES binary;
+CREATE TABLE `теÑÑ‚` (`теÑÑ‚` int);
+SHOW CREATE TABLE `теÑÑ‚`;
+Table Create Table
+теÑÑ‚ CREATE TABLE `теÑÑ‚` (
+ `теÑÑ‚` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SET NAMES utf8;
+SHOW CREATE TABLE `теÑÑ‚`;
+Table Create Table
+теÑÑ‚ CREATE TABLE `теÑÑ‚` (
+ `теÑÑ‚` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `теÑÑ‚`;
+SET NAMES binary;
+SET character_set_connection=utf8;
+SELECT 'теÑÑ‚' as s;
+s
+теÑÑ‚
+SET NAMES utf8;
+SET character_set_connection=binary;
+SELECT 'теÑÑ‚' as s;
+s
+теÑÑ‚
+SET NAMES binary;
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
+SET NAMES utf8;
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ` (a int)'
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index cb6fbecb6e8..2fd654da434 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -1655,3 +1655,110 @@ Z,z,Ź,ź,Ż,ż,Ž,ž
Ç
Ç‚
ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Ã,Â,Ã,Ä,Ã…,à,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,æ,Ǣ,ǣ,Ǽ,ǽ
+B,b
+Æ€
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,ÄŽ,Ä
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Ä,Ä‘
+Ɖ
+ÆŠ
+Ƌ,ƌ
+Ã,ð
+E,e,È,É,Ê,Ë,è,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+ÆŽ,Ç
+F,f
+Æ‘,Æ’
+G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ
+Ǥ,ǥ
+Æ“
+Æ”
+Æ¢,Æ£
+H,h,Ĥ,ĥ
+ƕ,Ƕ
+Ħ,ħ
+I,J,i,j,ÃŒ,Ã,ÃŽ,Ã,ì,í,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,Ä°,Ç,Ç
+IJ,Ij,iJ,ij
+IJ,ij
+ı
+Æ—
+Æ–
+Ĵ,ĵ,ǰ
+K,k,Ķ,ķ,Ǩ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,ļ,Ľ,ľ
+Ä¿,Å€
+LJ,Lj,lJ,lj
+LJ,Lj,lj
+LL,Ll,lL,ll
+Å,Å‚
+Æš
+Æ›
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Ǹ,ǹ
+NJ,Nj,nJ,nj
+NJ,Nj,nj
+Æž
+ÅŠ,Å‹
+O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Å’,Å“
+Ø,ø,Ǿ,ǿ
+Ɔ
+ÆŸ
+P,p
+Ƥ,ƥ
+Q,q
+ĸ
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+Ʀ
+S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Ţ,ţ,Ť,ť
+ƾ
+Ŧ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+Ù,Ú,Û,Ü,ù,ú,û,ü,Ũ,ũ,Ū,ū,Ŭ,ŭ,Ů,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+U,V,u,v
+Ʋ
+W,w,Ŵ,ŵ
+X,x
+Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ
+Ƴ,ƴ
+Z,z,Ź,ź,Ż,ż,Ž,ž
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+Ƹ,ƹ
+ƺ
+Þ,þ
+Æ¿,Ç·
+Æ»
+Ƨ,ƨ
+Ƽ,ƽ
+Æ„,Æ…
+ʼn
+Ç€
+Ç‚
+ǃ
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index f91691853b9..1baf9d8e01c 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -192,9 +192,9 @@ length(quote(concat(char(0),"test")))
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
27E0E3E6E7E8EAEB27
-select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678");
-unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678")
-foobar 1234567890ABCDEF 4Vx
+select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
+unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678") unhex(NULL)
+foobar 1234567890ABCDEF 4Vx NULL
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex("12345")) hex(unhex("123456"))
01 12 0123 1234 012345 123456
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 0ae4ec8dee1..aa6c0c3f505 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+SET NAMES binary;
delete from mysql.user where user='mysqltest_1';
delete from mysql.db where user='mysqltest_1';
flush privileges;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 6f341e12344..31e506d2679 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -1,3 +1,4 @@
+SET NAMES binary;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index b890f2e454e..892f1d940a6 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -198,6 +198,7 @@ Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 8
+set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 36ed1c6d51d..d809c9112b7 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -447,7 +447,7 @@ update t1, t2 set t1.b=1 where t1.a=t2.a;
update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
create table t1 (a int, primary key (a));
create table t2 (a int, primary key (a));
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 79472c70e8e..0e3bd555b0a 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -175,10 +175,10 @@ insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
a b c
19 4 0
-select * from t1 where b=4 and c<=5;
+select * from t1 where b=4 and c<=5 order by a;
a b c
-19 4 0
17 4 4
+19 4 0
select * from t1 where b<=4 and c<=5 order by a;
a b c
7 2 1
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 04c95271aad..d630730d96f 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -389,12 +389,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
@@ -402,12 +402,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index dfb147d0795..8cba3501a73 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -548,14 +548,14 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
-2.0000 0 1 0
18.0000 1 0 1
+2.0000 0 1 0
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
-2.0000 0 1 0
18.0000 1 0 1
+2.0000 0 1 0
18.0000 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
@@ -572,8 +572,8 @@ def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
+1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
@@ -581,8 +581,8 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
+1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
@@ -617,15 +617,15 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
-2 0 1 0
18 1 0 1
+2 0 1 0
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
-2 0 1 0
18 1 0 1
+2 0 1 0
18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
@@ -643,8 +643,8 @@ def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
+1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
@@ -653,8 +653,8 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
+1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index fab0b552b48..8fc035b0aef 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -432,12 +432,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
@@ -445,12 +445,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
@@ -1615,12 +1615,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
@@ -1628,12 +1628,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index ac0b38951c0..eeabd114b91 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -389,12 +389,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
@@ -402,12 +402,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
+3 ABC 1
+4 ABC 1
2 ABC 2
2 ABC 3
-2 ABC 4
-3 ABC 1
3 ABC 3
-4 ABC 1
+2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
index b60cad18c54..eef986d8f8c 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl000001.result
@@ -76,17 +76,17 @@ create table t1 (n int);
insert into t1 values(3456);
insert into mysql.user (Host, User, Password)
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
select_priv user
N blafasel2
-update mysql.user set Select_priv = "Y" where User="blafasel2";
-select select_priv,user from mysql.user where user = 'blafasel2';
+update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
+select select_priv,user from mysql.user where user = _binary'blafasel2';
select_priv user
Y blafasel2
select n from t1;
n
3456
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
select_priv user
Y blafasel2
drop table t1;
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
index 8d42957c9d3..d5f8ac4f293 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_charset.result
@@ -25,19 +25,19 @@ test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */
-set @@collation_server=armscii_bin;
+set @@collation_server=armscii8_bin;
drop database test3;
create database test3;
--- --master--
show create database test3;
Database Create Database
-test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
+test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
--- --slave--
show create database test3;
Database Create Database
-test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
+test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
use test2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
@@ -51,7 +51,7 @@ insert into t1 (b) values(@@collation_connection);
select * from t1 order by a;
a b
1 armscii8
-2 armscii_bin
+2 armscii8_bin
3 cp850
4 latin2
5 latin2_croatian_ci
@@ -60,7 +60,7 @@ a b
select * from test2.t1 order by a;
a b
1 armscii8
-2 armscii_bin
+2 armscii8_bin
3 cp850
4 latin2
5 latin2_croatian_ci
diff --git a/mysql-test/r/rpl_do_grant.result b/mysql-test/r/rpl_do_grant.result
index 983cdf46620..ff3e059503c 100644
--- a/mysql-test/r/rpl_do_grant.result
+++ b/mysql-test/r/rpl_do_grant.result
@@ -4,11 +4,11 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
@@ -17,10 +17,10 @@ Grants for rpl_do_grant@localhost
GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost'
set password for rpl_do_grant@localhost=password("does it work?");
-select password<>'' from mysql.user where user='rpl_do_grant';
-password<>''
+select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
+password<>_binary''
1
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
flush privileges;
diff --git a/mysql-test/r/rpl_ignore_grant.result b/mysql-test/r/rpl_ignore_grant.result
index 5e970e71d0b..5169cc8e888 100644
--- a/mysql-test/r/rpl_ignore_grant.result
+++ b/mysql-test/r/rpl_ignore_grant.result
@@ -4,11 +4,11 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
@@ -18,20 +18,20 @@ GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost'
show grants for rpl_ignore_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
-select count(*) from mysql.user where user='rpl_ignore_grant';
+select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
count(*)
0
-select count(*) from mysql.db where user='rpl_ignore_grant';
+select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
count(*)
0
grant select on *.* to rpl_ignore_grant@localhost;
set password for rpl_ignore_grant@localhost=password("does it work?");
-select password<>'' from mysql.user where user='rpl_ignore_grant';
-password<>''
+select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
+password<>_binary''
0
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 27daed64816..7aaaca043fd 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -395,8 +395,16 @@ show create database test_$1;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'test_$1'
drop table test_$1.t1;
drop database test_$1;
+set names binary;
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
+set names latin1;
+create database `ä`;
+create table `ä`.`ä` (a int) engine=heap;
+show table status from `ä` LIKE 'ä';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+ä HEAP 9 Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+drop database `ä`;
diff --git a/mysql-test/r/system_mysql_db_refs.result b/mysql-test/r/system_mysql_db_refs.result
index e15934b03ac..ac072505bc9 100644
--- a/mysql-test/r/system_mysql_db_refs.result
+++ b/mysql-test/r/system_mysql_db_refs.result
@@ -18,44 +18,44 @@ create table test_columns_priv select * from mysql.columns_priv;
delete from test_columns_priv;
insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
select
-if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
-if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
-if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
-if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
-if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
-from test_db
-left join test_host on test_db.Host=test_host.Host
-left join test_user on test_db.Host=test_user.Host
-left join test_tables_priv on test_db.Host=test_tables_priv.Host
+if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
+if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
+if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
+if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
+if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
+from test_db
+left join test_host on test_db.Host=test_host.Host
+left join test_user on test_db.Host=test_user.Host
+left join test_tables_priv on test_db.Host=test_tables_priv.Host
left join test_columns_priv on test_db.Host=test_columns_priv.Host;
test_db_Host test_host_Host test_user_Host test_tables_priv_Host test_columns_priv_Host
ok ok ok ok ok
select
-if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
-if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
-if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
-if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
-from test_db
-left join test_host on test_db.Db=test_host.Db
-left join test_tables_priv on test_db.Db=test_tables_priv.Db
+if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
+if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
+if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
+if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
+from test_db
+left join test_host on test_db.Db=test_host.Db
+left join test_tables_priv on test_db.Db=test_tables_priv.Db
left join test_columns_priv on test_db.Db=test_columns_priv.Db;
test_db_Db test_host_Db test_tables_priv_Db est_columns_priv_Db
ok ok ok ok
-select
-if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
-if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
-if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
-if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
-from test_db
-left join test_user on test_db.User=test_user.User
-left join test_tables_priv on test_db.User=test_tables_priv.User
+select
+if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
+if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
+if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
+if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
+from test_db
+left join test_user on test_db.User=test_user.User
+left join test_tables_priv on test_db.User=test_tables_priv.User
left join test_columns_priv on test_db.User=test_columns_priv.User;
test_db_User test_user_User test_tables_priv_User test_columns_priv_User
ok ok ok ok
-select
-if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
-if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
-from test_tables_priv
+select
+if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
+if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
+from test_tables_priv
left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
test_tables_priv_User test_columns_priv_User
ok ok
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 122dcaa6c49..5fed85d7f50 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -123,7 +123,7 @@ connection user1;
alter table t1 rename t2;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
#
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 7585ff0f608..32c1479ae04 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -42,7 +42,7 @@ show tables;
# check if old password version also works
-update mysql.user set password=old_password("gambling2") where user="test";
+update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
#connect (con1,localhost,test,gambling2,"");
@@ -68,5 +68,5 @@ show tables;
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
-delete from mysql.user where user="test";
+delete from mysql.user where user=_binary"test";
flush privileges;
diff --git a/mysql-test/t/ctype_create.test b/mysql-test/t/ctype_create.test
index bd8c22bb4f6..6d7ed6fc205 100644
--- a/mysql-test/t/ctype_create.test
+++ b/mysql-test/t/ctype_create.test
@@ -13,25 +13,48 @@
SET @@character_set_server=latin5;
-CREATE DATABASE db1 DEFAULT CHARACTER SET cp1251;
-USE db1;
-CREATE DATABASE db2;
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
+USE mysqltest1;
+CREATE DATABASE mysqltest2;
#
# This should be cp1251
#
-SHOW CREATE DATABASE db1;
+SHOW CREATE DATABASE mysqltest1;
#
-# This should take the default latin5 value from server level.
+# Database "mysqltest2" should take the default latin5 value from
+# the server level.
+# Afterwards, table "d2.t1" should inherit the default latin5 value from
+# the database "mysqltest2", using database option hash.
#
-SHOW CREATE DATABASE db2;
-DROP DATABASE db2;
+SHOW CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+DROP TABLE mysqltest2.t1;
+
+#
+# Now we check if the database charset is updated in
+# the database options hash when we ALTER DATABASE.
+#
+ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+DROP DATABASE mysqltest2;
+
+#
+# Now we check if the database charset is removed from
+# the database option hash when we DROP DATABASE.
+#
+CREATE DATABASE mysqltest2 CHARACTER SET latin2;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+DROP DATABASE mysqltest2;
#
# Check that table value uses database level by default
#
-USE db1;
+USE mysqltest1;
CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
DROP TABLE t1;
@@ -50,4 +73,4 @@ DROP TABLE t1;
#
#
#
-DROP DATABASE db1;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 8ac22e89c2d..de6332f272c 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -78,3 +78,32 @@ SET NAMES koi8r;
SELECT hex('ÔÅÓÔ');
SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');
+
+USE test;
+
+# Bug#4417
+# Check that identifiers and strings are not converted
+# when the client character set is binary.
+
+SET NAMES binary;
+CREATE TABLE `теÑÑ‚` (`теÑÑ‚` int);
+SHOW CREATE TABLE `теÑÑ‚`;
+SET NAMES utf8;
+SHOW CREATE TABLE `теÑÑ‚`;
+DROP TABLE `теÑÑ‚`;
+SET NAMES binary;
+SET character_set_connection=utf8;
+SELECT 'теÑÑ‚' as s;
+SET NAMES utf8;
+SET character_set_connection=binary;
+SELECT 'теÑÑ‚' as s;
+
+#
+# Test that we allow only well-formed UTF8 identitiers
+#
+SET NAMES binary;
+--error 1300
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+SET NAMES utf8;
+--error 1300
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 6ff1407247f..0ab46a5a637 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -178,4 +178,5 @@ select group_concat(c1 order by c1) from t1 group by c1 collate utf8_danish_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_lithuanian_ci;
--select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index cc8d8a88437..61d0326f7dd 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -78,7 +78,7 @@ select quote(concat('abc\'', '\\cba'));
select quote(1/0), quote('\0\Z');
select length(quote(concat(char(0),"test")));
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
-select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678");
+select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
select length(unhex(md5("abrakadabra")));
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 6bd2fa0c703..c112a0e0c1d 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -5,6 +5,8 @@
drop table if exists t1;
--enable_warnings
+SET NAMES binary;
+
#
# Test that SSL options works properly
#
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 1fc1ed78385..3a9afa7453b 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -1,3 +1,5 @@
+SET NAMES binary;
+
#
# GRANT tests that require several connections
# (usually it's GRANT, reconnect as another user, try something)
diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test
index 7806253124e..a82cd732802 100644
--- a/mysql-test/t/grant_cache.test
+++ b/mysql-test/t/grant_cache.test
@@ -126,6 +126,15 @@ show status like "Qcache_not_cached";
# Cleanup
connection root;
+#
+# A temporary 4.1 workaround to make this test pass if
+# mysql was compiled with other than latin1 --with-charset=XXX.
+# Without "set names binary" the below queries fail with
+# "Illegal mix of collations" error.
+# In 5.0 we will change grant tables to use NCHAR(N) instead
+# of "CHAR(N) BINARY", and use cast-to-nchar: N'mysqltest_1'.
+#
+set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index a3b733c3c03..56f01f2ae92 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -405,7 +405,7 @@ update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
#
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index 79686fce0e1..feb4476f5e7 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -106,7 +106,7 @@ select * from t1 where b<=5 order by a;
select * from t1 where b<=5 and c=0;
insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
-select * from t1 where b=4 and c<=5;
+select * from t1 where b=4 and c<=5 order by a;
select * from t1 where b<=4 and c<=5 order by a;
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
drop table t1;
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index b7686bbd26a..2c86c30f820 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -4,15 +4,9 @@
# #
##############################################################
-
-# Please do not
-# - modify (INSERT/UPDATE/DELETE) the content of the tables
-# t1 and t_many_col_types. Such tests should be done in
-# include/ps_modify.inc
-# - insert test cases where the results depend on the
-# table type. Such tests should be done in the files
-# include/ps_query.inc, include/ps_modify ...
-#
+#
+# NOTE: PLEASE SEE THE DETAILED DESCRIPTION AT THE BOTTOM OF THIS FILE
+# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
--disable_query_log
@@ -375,7 +369,6 @@ revoke all privileges on test.t1 from drop_user@localhost ;
--error 1295
prepare stmt3 from ' drop user drop_user@localhost ';
drop user drop_user@localhost;
---error 1141
#### table related commands
## describe
@@ -737,3 +730,101 @@ execute stmt1 using
@arg60, @arg61 ;
drop table t1 ;
+
+##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
+#
+# 0. You don't have the time to
+# - read and pay attention to these rules of thumb
+# - accept that QA may move your test case to a different place
+# (I will not change your code!!) .
+# Please append your test case to
+# t/ps.test
+#
+# 1. You have more time and want to get as much value from you test case as
+# possible. Please try to make the following decisions:
+#
+# Will the execution or result of the sub test case depend on the
+# properties of a storage engine ?
+#
+# NO --> alter t/ps_1general.test (Example: Command with syntax error)
+# If you need a table, please try to use
+# t1 - very simple table
+# t_many_col_types - table with nearly all available column types
+# whenever possible.
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable
+# '$type' . In ps_1general.test $type is set to 'MYISAM'.
+#
+# Please feel free to source ps_create.inc or ps_renew.inc
+# whenever you think it helps. But please restore the original
+# state of these tables after your tests, because the following
+# statements may depend on it.
+#
+# YES
+# |
+# |
+# Is it possible to apply the sub test case to all table types ?
+# YES --> alter include/ps_query.inc (for SELECTs)
+# include/ps_modify.inc (for INSERT/UPDATE/DELETE)
+# include/ps_modify1.inc (also for INSERT/UPDATE/DELETE,
+# but t/ps_5merge.test will not source that file)
+# Please try to find an appropriate place within the file.
+# It would be nice if we have some systematics in the
+# order of the sub test cases (if possible).
+#
+# Please be aware, that
+# include: ps_query.inc, ps_modify.inc, ps_modify1.inc
+# will be sourced by several test case files stored within the
+# subdirectory 't'. So every change here will affect several test
+# cases.
+#
+# NO
+# |
+# |
+# Append the sub test case to the appropriate
+# ps_<number><table type>.test .
+#
+# 2. The current structure of the PS tests
+#
+# t/ps_1general.test Check of basic PS features, SHOW commands and DDL
+# The tests should not depend on the table type.
+#
+# t/ps_2myisam Check of PS on tables of type MYISAM .
+# t/ps_3innodb Check of PS on tables of type InnoDB .
+# ...
+# t/ps_6bdb Check of PS on tables of type BDB .
+# All storage engine related tests use the variable $type to hold the
+# name of the storage engine.
+#
+# include/ps_query.inc test cases with SELECT/...
+# These test cases should not modify the content or
+# the structure (DROP/ALTER..) of the tables
+# 't1' and 't_many_col_types'.
+# include/ps_modify.inc test cases with INSERT/UPDATE/...
+# These test cases should not modify the structure
+# (DROP/ALTER..) of the tables
+# 't1' and 't_many_col_types'.
+# These two test sequences will be applied to all table types .
+#
+# include/ps_modify1.inc test cases with INSERT/UPDATE/...
+# This test sequences will be applied to all table types
+# except MERGE tables.
+#
+# include/ps_create.inc DROP and CREATE of the tables
+# 't1' and 't_many_col_types' .
+# include/ps_renew.inc DELETE all rows and INSERT some rows, that means
+# recreate the original content of these tables.
+# Please do not alter the commands concerning these two tables.
+#
+# Please feel free and encouraged to exploit the current code sharing
+# mechanism of the 'ps_<number><table type>' test cases. It is an convenient
+# way to check all storage engines.
+#
+# Thank you for reading these rules of thumb.
+#
+# Matthias
diff --git a/mysql-test/t/ps_2myisam.test b/mysql-test/t/ps_2myisam.test
index 3bb8b01cf87..c7e4746762b 100644
--- a/mysql-test/t/ps_2myisam.test
+++ b/mysql-test/t/ps_2myisam.test
@@ -4,6 +4,10 @@
# #
###############################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
use test;
let $type= 'MYISAM' ;
diff --git a/mysql-test/t/ps_3innodb.test b/mysql-test/t/ps_3innodb.test
index 71acf3b76f1..055e1e127e5 100644
--- a/mysql-test/t/ps_3innodb.test
+++ b/mysql-test/t/ps_3innodb.test
@@ -4,8 +4,14 @@
# #
###############################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
use test;
+-- source include/have_innodb.inc
+
let $type= 'InnoDB' ;
-- source include/ps_create.inc
-- source include/ps_renew.inc
diff --git a/mysql-test/t/ps_4heap.test b/mysql-test/t/ps_4heap.test
index 8aa715b095e..d1c81d95cd7 100644
--- a/mysql-test/t/ps_4heap.test
+++ b/mysql-test/t/ps_4heap.test
@@ -4,6 +4,10 @@
# #
###############################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
use test;
let $type= 'HEAP' ;
@@ -19,7 +23,8 @@ eval create table t1
--disable_warnings
drop table if exists t_many_col_types;
--enable_warnings
-# The used table type doesn't support BLOB/TEXT columns (error 1163)
+# The used table type doesn't support BLOB/TEXT columns.
+# (The server would send error 1163 .)
# So we use char(100) instead.
eval create table t_many_col_types
(
diff --git a/mysql-test/t/ps_5merge.test b/mysql-test/t/ps_5merge.test
index ee4beea78c4..ff48a50f331 100644
--- a/mysql-test/t/ps_5merge.test
+++ b/mysql-test/t/ps_5merge.test
@@ -4,6 +4,10 @@
# #
###############################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
use test;
--disable_warnings
diff --git a/mysql-test/t/ps_6bdb.test b/mysql-test/t/ps_6bdb.test
index dde6a05268e..7dbd08f5baa 100644
--- a/mysql-test/t/ps_6bdb.test
+++ b/mysql-test/t/ps_6bdb.test
@@ -4,6 +4,10 @@
# #
###############################################
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
use test;
-- source include/have_bdb.inc
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index 445bd579279..2e0ba2fff25 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -110,14 +110,14 @@ create table t1 (n int);
insert into t1 values(3456);
insert into mysql.user (Host, User, Password)
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = 'blafasel2';
-update mysql.user set Select_priv = "Y" where User="blafasel2";
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
+update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
+select select_priv,user from mysql.user where user = _binary'blafasel2';
save_master_pos;
connection slave;
sync_with_master;
select n from t1;
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
connection master1;
drop table t1;
save_master_pos;
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
index c13b57a3108..02bcdf1f5f1 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/t/rpl_charset.test
@@ -26,7 +26,7 @@ show create database test2;
show create database test3;
connection master;
-set @@collation_server=armscii_bin;
+set @@collation_server=armscii8_bin;
drop database test3;
create database test3;
--disable_query_log
diff --git a/mysql-test/t/rpl_do_grant.test b/mysql-test/t/rpl_do_grant.test
index 89ff1afb5c9..27a22874497 100644
--- a/mysql-test/t/rpl_do_grant.test
+++ b/mysql-test/t/rpl_do_grant.test
@@ -4,16 +4,16 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
# if these DELETE did nothing on the master, we need to do them manually on the
# slave.
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
# test replication of GRANT
@@ -31,12 +31,12 @@ set password for rpl_do_grant@localhost=password("does it work?");
save_master_pos;
connection slave;
sync_with_master;
-select password<>'' from mysql.user where user='rpl_do_grant';
+select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
# clear what we have done, to not influence other tests.
connection master;
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl_ignore_grant.test b/mysql-test/t/rpl_ignore_grant.test
index 2fd7f186b3e..9b012d08df3 100644
--- a/mysql-test/t/rpl_ignore_grant.test
+++ b/mysql-test/t/rpl_ignore_grant.test
@@ -6,16 +6,16 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
# as these DELETE were not replicated, we need to do them manually on the
# slave.
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
# test non-replication of GRANT
@@ -29,8 +29,8 @@ sync_with_master;
--error 1141 #("no such grant for user")
show grants for rpl_ignore_grant@localhost;
# check it another way
-select count(*) from mysql.user where user='rpl_ignore_grant';
-select count(*) from mysql.db where user='rpl_ignore_grant';
+select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
+select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
# test non-replication of SET PASSWORD
# first force creation of the user on slave (because as the user does not exist
@@ -42,16 +42,16 @@ set password for rpl_ignore_grant@localhost=password("does it work?");
save_master_pos;
connection slave;
sync_with_master;
-select password<>'' from mysql.user where user='rpl_ignore_grant';
+select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
# clear what we have done, to not influence other tests.
connection master;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 3ff2605cff4..ac0c9a43010 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -299,8 +299,17 @@ drop table test_$1.t1;
drop database test_$1;
connection default;
+set names binary;
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
+
+#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
+set names latin1;
+create database `ä`;
+create table `ä`.`ä` (a int) engine=heap;
+--replace_column 7 # 8 # 9 #
+show table status from `ä` LIKE 'ä';
+drop database `ä`;
diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test
index bd69297b739..85a2f7f9bae 100644
--- a/mysql-test/t/system_mysql_db.test
+++ b/mysql-test/t/system_mysql_db.test
@@ -1,8 +1,8 @@
-#
-# This test must examine integrity of system database "mysql"
-#
-
--- disable_query_log
-use mysql;
--- enable_query_log
--- source include/system_db_struct.inc
+#
+# This test must examine integrity of system database "mysql"
+#
+
+-- disable_query_log
+use mysql;
+-- enable_query_log
+-- source include/system_db_struct.inc
diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix.test
index a81772c74e4..13c83fc9012 100644
--- a/mysql-test/t/system_mysql_db_fix.test
+++ b/mysql-test/t/system_mysql_db_fix.test
@@ -1,83 +1,82 @@
-#
+#
# This is the test for mysql_fix_privilege_tables
-#
+#
--- disable_result_log
--- disable_query_log
-
-use test;
-
-# create system tables as in mysql-3.20
-
-CREATE TABLE db (
- Host char(60) binary DEFAULT '' NOT NULL,
- Db char(32) binary DEFAULT '' NOT NULL,
- User char(16) binary DEFAULT '' NOT NULL,
- Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- PRIMARY KEY Host (Host,Db,User),
- KEY User (User)
-)
-type=ISAM;
+-- disable_result_log
+-- disable_query_log
-INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
-INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
+use test;
-CREATE TABLE host (
- Host char(60) binary DEFAULT '' NOT NULL,
- Db char(32) binary DEFAULT '' NOT NULL,
- Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- PRIMARY KEY Host (Host,Db)
-)
-type=ISAM;
+# create system tables as in mysql-3.20
-CREATE TABLE user (
- Host char(60) binary DEFAULT '' NOT NULL,
- User char(16) binary DEFAULT '' NOT NULL,
- Password char(16),
- Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
- PRIMARY KEY Host (Host,User)
-)
-type=ISAM;
+CREATE TABLE db (
+ Host char(60) binary DEFAULT '' NOT NULL,
+ Db char(32) binary DEFAULT '' NOT NULL,
+ User char(16) binary DEFAULT '' NOT NULL,
+ Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ PRIMARY KEY Host (Host,Db,User),
+ KEY User (User)
+)
+type=ISAM;
+
+INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
+INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
+
+CREATE TABLE host (
+ Host char(60) binary DEFAULT '' NOT NULL,
+ Db char(32) binary DEFAULT '' NOT NULL,
+ Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ PRIMARY KEY Host (Host,Db)
+)
+type=ISAM;
+
+CREATE TABLE user (
+ Host char(60) binary DEFAULT '' NOT NULL,
+ User char(16) binary DEFAULT '' NOT NULL,
+ Password char(16),
+ Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ PRIMARY KEY Host (Host,User)
+)
+type=ISAM;
+
+INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
-INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
-INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
-
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
--- enable_query_log
--- enable_result_log
-
--- source include/system_db_struct.inc
-
--- disable_query_log
-
-DROP TABLE db;
-DROP TABLE host;
-DROP TABLE user;
-DROP TABLE func;
-DROP TABLE tables_priv;
-DROP TABLE columns_priv;
+-- enable_query_log
+-- enable_result_log
+
+-- source include/system_db_struct.inc
+
+-- disable_query_log
+
+DROP TABLE db;
+DROP TABLE host;
+DROP TABLE user;
+DROP TABLE func;
+DROP TABLE tables_priv;
+DROP TABLE columns_priv;
DROP TABLE help_category;
DROP TABLE help_keyword;
DROP TABLE help_relation;
DROP TABLE help_topic;
-
--- enable_query_log
+-- enable_query_log
diff --git a/mysql-test/t/system_mysql_db_refs.test b/mysql-test/t/system_mysql_db_refs.test
index 4c6557ba5c7..9e2c5a20b54 100644
--- a/mysql-test/t/system_mysql_db_refs.test
+++ b/mysql-test/t/system_mysql_db_refs.test
@@ -1,102 +1,101 @@
-#
-# This test must examine integrity of current system database
-#
-
-set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
-
-#
-# If this part is wrong, most likely you've done wrong modification of system database "mysql"
-#
-
-create table test_db select * from mysql.db;
-delete from test_db;
+#
+# This test must examine integrity of current system database
+#
+
+set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
+
+#
+# If this part is wrong, most likely you've done wrong modification of system database "mysql"
+#
+
+create table test_db select * from mysql.db;
+delete from test_db;
--disable_warnings
-insert into test_db (Host,Db,User) values (@name,@name,@name);
+insert into test_db (Host,Db,User) values (@name,@name,@name);
--enable_warnings
-
-create table test_host select * from mysql.host;
-delete from test_host;
+
+create table test_host select * from mysql.host;
+delete from test_host;
--disable_warnings
-insert into test_host (Host,Db) values (@name,@name);
+insert into test_host (Host,Db) values (@name,@name);
--enable_warnings
-
-create table test_user select * from mysql.user;
-delete from test_user;
+
+create table test_user select * from mysql.user;
+delete from test_user;
--disable_warnings
-insert into test_user (Host,User) values (@name,@name);
+insert into test_user (Host,User) values (@name,@name);
--enable_warnings
-
-create table test_func select * from mysql.func;
-delete from test_func;
+
+create table test_func select * from mysql.func;
+delete from test_func;
--disable_warnings
-insert into test_func (name) values (@name);
+insert into test_func (name) values (@name);
--enable_warnings
-
-create table test_tables_priv select * from mysql.tables_priv;
-delete from test_tables_priv;
+
+create table test_tables_priv select * from mysql.tables_priv;
+delete from test_tables_priv;
--disable_warnings
-insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
+insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
--enable_warnings
-
-create table test_columns_priv select * from mysql.columns_priv;
-delete from test_columns_priv;
+
+create table test_columns_priv select * from mysql.columns_priv;
+delete from test_columns_priv;
--disable_warnings
-insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
+insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
--enable_warnings
-
-# 'Host' field must be the same for all the tables:
-
+
+# 'Host' field must be the same for all the tables:
+
select
- if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
- if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
- if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
- if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
- if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
-
-from test_db
-left join test_host on test_db.Host=test_host.Host
-left join test_user on test_db.Host=test_user.Host
-left join test_tables_priv on test_db.Host=test_tables_priv.Host
-left join test_columns_priv on test_db.Host=test_columns_priv.Host;
-
-# 'Db' field must be the same for all the tables:
-
+ if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
+ if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
+ if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
+ if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
+ if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
+
+from test_db
+left join test_host on test_db.Host=test_host.Host
+left join test_user on test_db.Host=test_user.Host
+left join test_tables_priv on test_db.Host=test_tables_priv.Host
+left join test_columns_priv on test_db.Host=test_columns_priv.Host;
+
+# 'Db' field must be the same for all the tables:
+
+select
+ if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
+ if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
+ if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
+ if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
+
+from test_db
+left join test_host on test_db.Db=test_host.Db
+left join test_tables_priv on test_db.Db=test_tables_priv.Db
+left join test_columns_priv on test_db.Db=test_columns_priv.Db;
+
+# 'User' field must be the same for all the tables:
+
+select
+ if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
+ if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
+ if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
+ if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
+
+from test_db
+left join test_user on test_db.User=test_user.User
+left join test_tables_priv on test_db.User=test_tables_priv.User
+left join test_columns_priv on test_db.User=test_columns_priv.User;
+
+# 'Table_name' field must be the same for all the tables:
+
select
- if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
- if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
- if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
- if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
-
-from test_db
-left join test_host on test_db.Db=test_host.Db
-left join test_tables_priv on test_db.Db=test_tables_priv.Db
-left join test_columns_priv on test_db.Db=test_columns_priv.Db;
-
-# 'User' field must be the same for all the tables:
-
-select
- if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
- if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
- if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
- if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
-
-from test_db
-left join test_user on test_db.User=test_user.User
-left join test_tables_priv on test_db.User=test_tables_priv.User
-left join test_columns_priv on test_db.User=test_columns_priv.User;
-
-# 'Table_name' field must be the same for all the tables:
-
-select
- if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
- if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
-from test_tables_priv
-left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
-
-drop table test_columns_priv;
-drop table test_tables_priv;
-drop table test_func;
-drop table test_host;
-drop table test_user;
-drop table test_db;
+ if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
+ if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
+from test_tables_priv
+left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
+drop table test_columns_priv;
+drop table test_tables_priv;
+drop table test_func;
+drop table test_host;
+drop table test_user;
+drop table test_db;
diff --git a/mysys/charset-def.c b/mysys/charset-def.c
index 73e36688594..420a13a592d 100644
--- a/mysys/charset-def.c
+++ b/mysys/charset-def.c
@@ -38,6 +38,7 @@ extern CHARSET_INFO my_charset_ucs2_danish_uca_ci;
extern CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci;
extern CHARSET_INFO my_charset_ucs2_slovak_uca_ci;
extern CHARSET_INFO my_charset_ucs2_spanish2_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_roman_uca_ci;
#endif
#ifdef HAVE_CHARSET_utf8
@@ -56,6 +57,7 @@ extern CHARSET_INFO my_charset_utf8_danish_uca_ci;
extern CHARSET_INFO my_charset_utf8_lithuanian_uca_ci;
extern CHARSET_INFO my_charset_utf8_slovak_uca_ci;
extern CHARSET_INFO my_charset_utf8_spanish2_uca_ci;
+extern CHARSET_INFO my_charset_utf8_roman_uca_ci;
#endif
my_bool init_compiled_charsets(myf flags __attribute__((unused)))
@@ -124,6 +126,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_ucs2_lithuanian_uca_ci);
add_compiled_collation(&my_charset_ucs2_slovak_uca_ci);
add_compiled_collation(&my_charset_ucs2_spanish2_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_roman_uca_ci);
#endif
#ifdef HAVE_CHARSET_ujis
@@ -149,6 +152,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_utf8_lithuanian_uca_ci);
add_compiled_collation(&my_charset_utf8_slovak_uca_ci);
add_compiled_collation(&my_charset_utf8_spanish2_uca_ci);
+ add_compiled_collation(&my_charset_utf8_roman_uca_ci);
#endif
/* Copy compiled charsets */
diff --git a/mysys/my_init.c b/mysys/my_init.c
index da0e6caf96d..0ef938b434c 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -127,6 +127,7 @@ void my_end(int infoflag)
FILE *info_file;
if (!(info_file=DBUG_FILE))
info_file=stderr;
+ DBUG_PRINT("info",("Shutting down"));
if (infoflag & MY_CHECK_ERROR || info_file != stderr)
{ /* Test if some file is left open */
if (my_file_opened | my_stream_opened)
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 055e00d2efc..0207d9a3683 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -461,6 +461,17 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
else
finfo.mystat= NULL;
+ /*
+ If the directory is the root directory of the drive, Windows sometimes
+ creates hidden or system files there (like RECYCLER); do not show
+ them. We would need to see how this can be achieved with a Borland
+ compiler.
+ */
+#ifndef __BORLANDC__
+ if (attrib & (_A_HIDDEN | _A_SYSTEM))
+ continue;
+#endif
+
if (push_dynamic(dir_entries_storage, (gptr)&finfo))
goto error;
diff --git a/ndb/include/util/ConfigValues.hpp b/ndb/include/util/ConfigValues.hpp
index 48e1363bf4a..3fbeedb25a0 100644
--- a/ndb/include/util/ConfigValues.hpp
+++ b/ndb/include/util/ConfigValues.hpp
@@ -24,8 +24,8 @@ public:
ValueType m_type;
union {
Uint32 m_int;
- const char * m_string;
Uint64 m_int64;
+ const char * m_string;
};
};
@@ -72,14 +72,14 @@ private:
friend class ConstIterator;
bool getByPos(Uint32 pos, Entry *) const;
- Uint64 & get64(Uint32 index) const;
- char * & getString(Uint32 index) const;
+ Uint64 * get64(Uint32 index) const;
+ char ** getString(Uint32 index) const;
Uint32 m_size;
Uint32 m_dataSize;
Uint32 m_stringCount;
Uint32 m_int64Count;
-
+
Uint32 m_values[1];
void * m_data[1];
};
diff --git a/ndb/src/common/util/ConfigValues.cpp b/ndb/src/common/util/ConfigValues.cpp
index 18ecf4bcdc4..7fc99bc526c 100644
--- a/ndb/src/common/util/ConfigValues.cpp
+++ b/ndb/src/common/util/ConfigValues.cpp
@@ -60,7 +60,7 @@ ConfigValues::ConfigValues(Uint32 sz, Uint32 dsz){
ConfigValues::~ConfigValues(){
for(Uint32 i = 0; i<m_stringCount; i++){
- free(getString(i));
+ free(* getString(i));
}
}
@@ -87,10 +87,10 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
result->m_int = val;
break;
case StringType:
- result->m_string = getString(val);
+ result->m_string = * getString(val);
break;
case Int64Type:
- result->m_int64 = get64(val);
+ result->m_int64 = * get64(val);
break;
case InvalidType:
default:
@@ -102,18 +102,23 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
return true;
}
-Uint64 &
+Uint64 *
ConfigValues::get64(Uint32 index) const {
assert(index < m_int64Count);
- Uint64 * ptr = (Uint64*)(&m_values[m_size << 1]);
- return ptr[index];
+ const Uint32 * data = m_values + (m_size << 1);
+ Uint64 * ptr = (Uint64*)data;
+ ptr += index;
+ return ptr;
}
-char * &
+char **
ConfigValues::getString(Uint32 index) const {
- assert(index < m_stringCount);
- char ** ptr = (char**)(((char *)&(m_values[m_size << 1])) + m_dataSize);
- return ptr[-index];
+ assert(index < m_stringCount);
+ const Uint32 * data = m_values + (m_size << 1);
+ char * ptr = (char*)data;
+ ptr += m_dataSize;
+ ptr -= (index * sizeof(char *));
+ return (char**)ptr;
}
bool
@@ -176,7 +181,7 @@ ConfigValues::Iterator::set(Uint32 key, Uint64 value){
return false;
}
- m_cfg.get64(m_cfg.m_values[pos+1]) = value;
+ * m_cfg.get64(m_cfg.m_values[pos+1]) = value;
return true;
}
@@ -191,9 +196,9 @@ ConfigValues::Iterator::set(Uint32 key, const char * value){
return false;
}
- char * & str = m_cfg.getString(m_cfg.m_values[pos+1]);
- free(str);
- str = strdup(value ? value : "");
+ char ** str = m_cfg.getString(m_cfg.m_values[pos+1]);
+ free(* str);
+ * str = strdup(value ? value : "");
return true;
}
@@ -457,7 +462,8 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case ConfigValues::StringType:{
Uint32 index = m_cfg->m_stringCount++;
m_cfg->m_values[pos+1] = index;
- m_cfg->getString(index) = strdup(entry.m_string ? entry.m_string : "");
+ char ** ref = m_cfg->getString(index);
+ * ref = strdup(entry.m_string ? entry.m_string : "");
m_freeKeys--;
m_freeData -= sizeof(char *);
DEBUG printf("Putting at: %d(%d) (loop = %d) key: %d value(%d): %s\n",
@@ -470,7 +476,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case ConfigValues::Int64Type:{
Uint32 index = m_cfg->m_int64Count++;
m_cfg->m_values[pos+1] = index;
- m_cfg->get64(index) = entry.m_int64;
+ * m_cfg->get64(index) = entry.m_int64;
m_freeKeys--;
m_freeData -= 8;
DEBUG printf("Putting at: %d(%d) (loop = %d) key: %d value64(%d): %lld\n",
@@ -558,7 +564,7 @@ ConfigValues::getPackedSize() const {
break;
case StringType:
size += 8; // key + len
- size += mod4(strlen(getString(m_values[i+1])) + 1);
+ size += mod4(strlen(* getString(m_values[i+1])) + 1);
break;
case InvalidType:
default:
@@ -587,7 +593,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
* (Uint32*)dst = htonl(val); dst += 4;
break;
case Int64Type:{
- Uint64 i64 = get64(val);
+ Uint64 i64 = * get64(val);
Uint32 hi = (i64 >> 32);
Uint32 lo = (i64 & 0xFFFFFFFF);
* (Uint32*)dst = htonl(key); dst += 4;
@@ -596,7 +602,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
}
break;
case StringType:{
- const char * str = getString(val);
+ const char * str = * getString(val);
Uint32 len = strlen(str) + 1;
* (Uint32*)dst = htonl(key); dst += 4;
* (Uint32*)dst = htonl(len); dst += 4;
diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
index c763d3b4786..fe737fc584b 100644
--- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
@@ -63,7 +63,7 @@ Ndbfs::Ndbfs(const Configuration & conf) :
const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
ndbrequire(p != 0);
- m_maxOpenedFiles = 40;
+ m_maxFiles = 40;
//ndb_mgm_get_int_parameter(p, CFG_DB_MAX_OPEN_FILES, &m_maxFiles);
// Create idle AsyncFiles
diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp
index 284d29dcefa..4fc6bb97f73 100644
--- a/ndb/src/kernel/vm/ArrayPool.hpp
+++ b/ndb/src/kernel/vm/ArrayPool.hpp
@@ -795,8 +795,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(Ptr<T> & ptr){
Uint32 i = ptr.i;
- if(i < size){
- ptr.p = &theArray[i];
+ if(i < this->size){
+ ptr.p = &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@@ -808,8 +808,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(ConstPtr<T> & ptr) const{
Uint32 i = ptr.i;
- if(i < size){
- ptr.p = &theArray[i];
+ if(i < this->size){
+ ptr.p = &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@@ -820,8 +820,8 @@ template <class T>
inline
T *
UnsafeArrayPool<T>::getPtrForce(Uint32 i){
- if(i < size){
- return &theArray[i];
+ if(i < this->size){
+ return &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@@ -833,8 +833,8 @@ template <class T>
inline
const T *
UnsafeArrayPool<T>::getConstPtrForce(Uint32 i) const {
- if(i < size){
- return &theArray[i];
+ if(i < this->size){
+ return &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@@ -847,8 +847,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(Ptr<T> & ptr, Uint32 i){
ptr.i = i;
- if(i < size){
- ptr.p = &theArray[i];
+ if(i < this->size){
+ ptr.p = &this->theArray[i];
return ;
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
@@ -861,8 +861,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(ConstPtr<T> & ptr, Uint32 i) const{
ptr.i = i;
- if(i < size){
- ptr.p = &theArray[i];
+ if(i < this->size){
+ ptr.p = &this->theArray[i];
return ;
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
diff --git a/ndb/src/kernel/vm/DLFifoList.hpp b/ndb/src/kernel/vm/DLFifoList.hpp
index 91b5b421b0c..b139ade831d 100644
--- a/ndb/src/kernel/vm/DLFifoList.hpp
+++ b/ndb/src/kernel/vm/DLFifoList.hpp
@@ -153,11 +153,11 @@ public:
LocalDLFifoList(ArrayPool<T> & thePool, typename DLFifoList<T>::Head & _src)
: DLFifoList<T>(thePool), src(_src)
{
- head = src;
+ this->head = src;
}
~LocalDLFifoList(){
- src = head;
+ src = this->head;
}
private:
typename DLFifoList<T>::Head & src;
diff --git a/ndb/src/kernel/vm/DLList.hpp b/ndb/src/kernel/vm/DLList.hpp
index f16ccd312f7..b7820eb9229 100644
--- a/ndb/src/kernel/vm/DLList.hpp
+++ b/ndb/src/kernel/vm/DLList.hpp
@@ -169,11 +169,11 @@ public:
LocalDLList(ArrayPool<T> & thePool, typename DLList<T>::Head & _src)
: DLList<T>(thePool), src(_src)
{
- head = src;
+ this->head = src;
}
~LocalDLList(){
- src = head;
+ src = this->head;
}
private:
typename DLList<T>::Head & src;
diff --git a/ndb/src/kernel/vm/DataBuffer.hpp b/ndb/src/kernel/vm/DataBuffer.hpp
index 3425fca76a3..7dc89aa638c 100644
--- a/ndb/src/kernel/vm/DataBuffer.hpp
+++ b/ndb/src/kernel/vm/DataBuffer.hpp
@@ -174,11 +174,11 @@ public:
typename DataBuffer<sz>::Head & _src)
: DataBuffer<sz>(thePool), src(_src)
{
- head = src;
+ this->head = src;
}
~LocalDataBuffer(){
- src = head;
+ src = this->head;
}
private:
typename DataBuffer<sz>::Head & src;
diff --git a/ndb/src/kernel/vm/SLList.hpp b/ndb/src/kernel/vm/SLList.hpp
index 47bc7b8b241..5fde41aa3e0 100644
--- a/ndb/src/kernel/vm/SLList.hpp
+++ b/ndb/src/kernel/vm/SLList.hpp
@@ -137,11 +137,11 @@ public:
LocalSLList(ArrayPool<T> & thePool, typename SLList<T>::Head & _src)
: SLList<T>(thePool), src(_src)
{
- head = src;
+ this->head = src;
}
~LocalSLList(){
- src = head;
+ src = this->head;
}
private:
typename SLList<T>::Head & src;
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 9589639a332..348f6db36e4 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -1417,7 +1417,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
s = SimpleProperties::pack(w,
&tmpAttr,
DictTabInfo::AttributeMapping,
- DictTabInfo::TableMappingSize, true);
+ DictTabInfo::AttributeMappingSize, true);
w.add(DictTabInfo::AttributeEnd, 1);
}
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
index f3c5c009f1c..79b4bc627b7 100644
--- a/scripts/mysql_fix_privilege_tables.sh
+++ b/scripts/mysql_fix_privilege_tables.sh
@@ -17,8 +17,24 @@ bindir=""
file=mysql_fix_privilege_tables.sql
+# The following test is to make this script compatible with the 4.0 where
+# the single argument could be a password
+if test "$#" = 1
+then
+ case "$1" in
+ --*) ;;
+ *) old_style_password="$1" ; shift ;;
+ esac
+fi
+
# The following code is almost identical to the code in mysql_install_db.sh
+case "$1" in
+ --no-defaults|--defaults-file=*|--defaults-extra-file=*)
+ defaults="$1"; shift
+ ;;
+esac
+
parse_arguments() {
# We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on
@@ -36,7 +52,7 @@ parse_arguments() {
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --sql|--sql-only) sql_only=1;;
+ --sql|--sql-only) sql_only=1 ;;
--verbose) verbose=1 ;;
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
@@ -47,7 +63,7 @@ parse_arguments() {
then
# This sed command makes sure that any special chars are quoted,
# so the arg gets passed exactly to the server.
- args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.-]\),\\\\\1,g'`
+ args="$args "`echo "$arg" | sed -e 's,\([^=a-zA-Z0-9_.-]\),\\\\\1,g'`
fi
;;
esac
@@ -94,11 +110,9 @@ else
fi
fi
-# The following test is to make this script compatible with the 4.0 where
-# the first argument was the password
if test -z "$password"
then
- password=`echo $args | sed -e 's/ *//g'`
+ password=$old_style_password
fi
cmd="$bindir/mysql -f --user=$user --host=$host"
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 6388855eaa6..af4e6084c59 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -8,6 +8,7 @@ use File::Path;
use DBI;
use Sys::Hostname;
use File::Copy;
+use File::Temp;
=head1 NAME
@@ -626,7 +627,6 @@ sub copy_files {
sub copy_index
{
my ($method, $files, $source, $target) = @_;
- my $tmpfile="$opt_tmpdir/mysqlhotcopy$$";
print "Copying indices for ".@$files." files...\n" unless $opt{quiet};
foreach my $file (@$files)
@@ -652,23 +652,23 @@ sub copy_index
}
close OUTPUT || die "Error on close of $to: $!\n";
}
- elsif ($opt{method} eq 'scp')
+ elsif ($opt{method} =~ /^scp\b/)
{
- my $tmp=$tmpfile;
- open(OUTPUT,">$tmp") || die "Can\'t create file $tmp: $!\n";
- if (syswrite(OUTPUT,$buff) != length($buff))
+ my ($fh, $tmp)=tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir);
+ die "Can\'t create/open file in $opt_tmpdir\n";
+ if (syswrite($fh,$buff) != length($buff))
{
die "Error when writing data to $tmp: $!\n";
}
- close OUTPUT || die "Error on close of $tmp: $!\n";
- safe_system("scp $tmp $to");
+ close $fh || die "Error on close of $tmp: $!\n";
+ safe_system("$opt{method} $tmp $to");
+ unlink $tmp;
}
else
{
die "Can't use unsupported method '$opt{method}'\n";
}
}
- unlink "$tmpfile" if ($opt{method} eq 'scp');
}
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc
index e052a819ef8..a4fe2aaa8cc 100644
--- a/sql/examples/ha_archive.cc
+++ b/sql/examples/ha_archive.cc
@@ -188,9 +188,9 @@ static int free_share(ARCHIVE_SHARE *share)
hash_delete(&archive_open_tables, (byte*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
if (gzclose(share->archive_write) == Z_ERRNO)
rc= -1;
+ my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);
diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h
index 03e296d0eae..2fab80f0598 100644
--- a/sql/examples/ha_archive.h
+++ b/sql/examples/ha_archive.h
@@ -72,7 +72,7 @@ public:
return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_NO_AUTO_INCREMENT |
HA_FILE_BASED);
}
- ulong index_flags(uint idx, uint part) const
+ ulong index_flags(uint idx, uint part, bool all_parts) const
{
return 0;
}
diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h
index dc8f265c16e..3c6ce4220ee 100644
--- a/sql/examples/ha_example.h
+++ b/sql/examples/ha_example.h
@@ -69,12 +69,16 @@ public:
return 0;
}
/*
- This is a list of flags that says how the storage engine
+ This is a bitmap of flags that says how the storage engine
implements indexes. The current index flags are documented in
handler.h. If you do not implement indexes, just return zero
here.
+
+ part is the key part to check. First key part is 0
+ If all_parts it's set, MySQL want to know the flags for the combined
+ index up to and including 'part'.
*/
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return 0;
}
diff --git a/sql/field.cc b/sql/field.cc
index 2d3729817b7..26c84575b4d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -431,9 +431,9 @@ void Field::store_time(TIME *ltime,timestamp_type type)
}
-bool Field::optimize_range(uint idx)
+bool Field::optimize_range(uint idx, uint part)
{
- return test(table->file->index_flags(idx) & HA_READ_RANGE);
+ return test(table->file->index_flags(idx, part, 1) & HA_READ_RANGE);
}
/****************************************************************************
diff --git a/sql/field.h b/sql/field.h
index a2fe77e18a3..24faee9d314 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -178,7 +178,7 @@ public:
inline bool real_maybe_null(void) { return null_ptr != 0; }
virtual void make_field(Send_field *)=0;
virtual void sort_string(char *buff,uint length)=0;
- virtual bool optimize_range(uint idx);
+ virtual bool optimize_range(uint idx, uint part);
virtual bool store_for_compare() { return 0; }
virtual void free() {}
Field *new_field(MEM_ROOT *root, struct st_table *new_table)
@@ -1134,7 +1134,7 @@ public:
uint size_of() const { return sizeof(*this); }
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 optimize_range(uint idx, uint part) { return 0; }
bool eq_def(Field *field);
bool has_charset(void) const { return TRUE; }
field_cast_enum field_cast_type() { return FIELD_CAST_ENUM; }
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index e25640280a3..00df84e3797 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -340,6 +340,35 @@ const char **ha_berkeley::bas_ext() const
{ static const char *ext[]= { ha_berkeley_ext, NullS }; return ext; }
+ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const
+{
+ ulong flags= (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEYREAD_ONLY
+ | HA_READ_RANGE);
+ for (uint i= all_parts ? 0 : part ; i <= part ; i++)
+ {
+ if (table->key_info[idx].key_part[i].field->type() == FIELD_TYPE_BLOB)
+ {
+ /* We can't use BLOBS to shortcut sorts */
+ flags&= ~(HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE);
+ break;
+ }
+ switch (table->key_info[idx].key_part[i].field->key_type()) {
+ case HA_KEYTYPE_TEXT:
+ case HA_KEYTYPE_VARTEXT:
+ /*
+ As BDB stores only one copy of equal strings, we can't use key read
+ on these
+ */
+ flags&= ~HA_KEYREAD_ONLY;
+ break;
+ default: // Keep compiler happy
+ break;
+ }
+ }
+ return flags;
+}
+
+
static int
berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key)
{
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 3213a81fadf..975d70abf7b 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -94,14 +94,7 @@ class ha_berkeley: public handler
changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0) {}
~ha_berkeley() {}
const char *table_type() const { return "BerkeleyDB"; }
- ulong index_flags(uint idx, uint part) const
- {
- ulong flags=HA_READ_NEXT | HA_READ_PREV;
- if (part == (uint)~0 ||
- table->key_info[idx].key_part[part].field->key_type() != HA_KEYTYPE_TEXT)
- flags|= HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE;
- return flags;
- }
+ ulong index_flags(uint idx, uint part, bool all_parts) const;
const char *index_type(uint key_number) { return "BTREE"; }
const char **bas_ext() const;
ulong table_flags(void) const { return int_table_flags; }
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 9d0b9999300..c326f570feb 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -44,7 +44,7 @@ class ha_heap: public handler
HA_REC_NOT_IN_SEQ | HA_READ_RND_SAME |
HA_CAN_INSERT_DELAYED);
}
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 0a86f4adf3c..a158321c5df 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -94,7 +94,7 @@ class ha_innobase: public handler
const char *index_type(uint key_number) { return "BTREE"; }
const char** bas_ext() const;
ulong table_flags() const { return int_table_flags; }
- ulong index_flags(uint idx, uint part) const
+ ulong index_flags(uint idx, uint part, bool all_parts) const
{
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE |
HA_KEYREAD_ONLY);
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index 521946a17b5..b3e932696cb 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -36,7 +36,7 @@ class ha_isam: public handler
HA_DUPP_POS | HA_NOT_DELETE_WITH_CACHE | HA_FILE_BASED)
{}
~ha_isam() {}
- ulong index_flags(uint idx, uint part) const
+ ulong index_flags(uint idx, uint part, bool all_parts) const
{ return HA_READ_NEXT; } // but no HA_READ_PREV here!!!
const char *table_type() const { return "ISAM"; }
const char *index_type(uint key_number) { return "BTREE"; }
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index 166a96cf9e4..657e5060272 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -34,7 +34,8 @@ class ha_isammrg: public handler
const char **bas_ext() const;
ulong table_flags() const { return (HA_READ_RND_SAME |
HA_REC_NOT_IN_SEQ | HA_FILE_BASED); }
- ulong index_flags(uint idx, uint part) const { DBUG_ASSERT(0); return 0; }
+ ulong index_flags(uint idx, uint part, bool all_parts) const
+ { DBUG_ASSERT(0); return 0; }
uint max_supported_keys() const { return 0; }
bool low_byte_first() const { return 0; }
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index ef3f00577dd..6fde84d6f6f 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -55,11 +55,11 @@ class ha_myisam: public handler
const char *index_type(uint key_number);
const char **bas_ext() const;
ulong table_flags() const { return int_table_flags; }
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
- 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
- HA_READ_ORDER | HA_KEYREAD_ONLY);
+ 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index 995cfe9ad4a..264c580220c 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -38,11 +38,11 @@ class ha_myisammrg: public handler
HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED |
HA_CAN_INSERT_DELAYED);
}
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
- 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
- HA_READ_ORDER | HA_KEYREAD_ONLY);
+ 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index d499218a8c3..5b36d6d2b55 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -524,7 +524,8 @@ inline NDB_INDEX_TYPE ha_ndbcluster::get_index_type(uint idx_no) const
flags depending on the type of the index.
*/
-inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part) const
+inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
+ bool all_parts) const
{
DBUG_ENTER("index_flags");
DBUG_PRINT("info", ("idx_no: %d", idx_no));
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 39c1779a27a..f094b79ef35 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -93,7 +93,7 @@ class ha_ndbcluster: public handler
const char * table_type() const { return("ndbcluster");}
const char ** bas_ext() const;
ulong table_flags(void) const { return m_table_flags; }
- ulong index_flags(uint idx, uint part) const;
+ ulong index_flags(uint idx, uint part, bool all_parts) const;
uint max_supported_record_length() const { return NDB_MAX_TUPLE_SIZE; };
uint max_supported_keys() const { return MAX_KEY; }
uint max_supported_key_parts() const
diff --git a/sql/handler.h b/sql/handler.h
index 13874fa6bb0..2cc0858f26c 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -449,7 +449,7 @@ public:
virtual const char *table_type() const =0;
virtual const char **bas_ext() const =0;
virtual ulong table_flags(void) const =0;
- virtual ulong index_flags(uint idx, uint part=~0) const =0;
+ virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
virtual ulong index_ddl_flags(KEY *wanted_index) const
{ return (HA_DDL_SUPPORT); }
virtual int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys)
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 91257c31fb9..60f80249e94 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -483,7 +483,14 @@ bool Item_in_optimizer::fix_left(THD *thd,
return 1;
cache->setup(args[0]);
- cache->store(args[0]);
+ /*
+ If it is preparation PS only then we do not know values of parameters =>
+ cant't get there values and do not need that values.
+
+ TODO: during merge with 5.0 it should be changed on !thd->only_prepare()
+ */
+ if (!thd->current_statement)
+ cache->store(args[0]);
if (cache->cols() == 1)
{
if ((used_tables_cache= args[0]->used_tables()))
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index d95271a54bb..66a223f0ebf 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -313,12 +313,12 @@ err:
/*
- Functions to concatinate various spatial objects
+ Functions to concatenate various spatial objects
*/
/*
-* Concatinate doubles into Point
+* Concatenate doubles into Point
*/
@@ -343,7 +343,7 @@ String *Item_func_point::val_str(String *str)
/*
- Concatinates various items into various collections
+ Concatenates various items into various collections
with checkings for valid wkb type of items.
For example, MultiPoint can be a collection of Points only.
coll_type contains wkb type of target collection.
@@ -388,7 +388,7 @@ String *Item_func_spatial_collection::val_str(String *str)
const char *data= res->ptr() + 1;
/*
- In the case of named collection we must to check that items
+ In the case of named collection we must check that items
are of specific type, let's do this checking now
*/
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b0c685c1c46..a8805be7854 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2294,40 +2294,49 @@ inline int hexchar_to_int(char c)
return -1;
}
+
+ /* Convert given hex string to a binary string */
+
String *Item_func_unhex::val_str(String *str)
{
- DBUG_ASSERT(fixed == 1);
- /* Convert given hex string to a binary string */
- String *res= args[0]->val_str(str);
- const char *from=res->ptr(), *end;
+ const char *from, *end;
char *to;
- int r;
- if (!res || tmp_value.alloc((1+res->length())/2))
+ String *res;
+ uint length;
+ DBUG_ASSERT(fixed == 1);
+
+ res= args[0]->val_str(str);
+ if (!res || tmp_value.alloc(length= (1+res->length())/2))
{
null_value=1;
return 0;
}
- null_value=0;
- tmp_value.length((1+res->length())/2);
+
+ from= res->ptr();
+ null_value= 0;
+ tmp_value.length(length);
to= (char*) tmp_value.ptr();
if (res->length() % 2)
{
- *to++= r= hexchar_to_int(*from++);
- if ((null_value= (r == -1)))
+ int hex_char;
+ *to++= hex_char= hexchar_to_int(*from++);
+ if ((null_value= (hex_char == -1)))
return 0;
}
for (end=res->ptr()+res->length(); from < end ; from+=2, to++)
{
- *to= (r= hexchar_to_int(from[0])) << 4;
- if ((null_value= (r == -1)))
+ int hex_char;
+ *to= (hex_char= hexchar_to_int(from[0])) << 4;
+ if ((null_value= (hex_char == -1)))
return 0;
- *to|= r= hexchar_to_int(from[1]);
- if ((null_value= (r == -1)))
+ *to|= hex_char= hexchar_to_int(from[1]);
+ if ((null_value= (hex_char == -1)))
return 0;
}
return &tmp_value;
}
+
void Item_func_binary::print(String *str)
{
str->append("cast(", 5);
diff --git a/sql/log.cc b/sql/log.cc
index 225aaae0549..ed4d6c8521e 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2108,10 +2108,8 @@ bool flush_error_log()
bool MYSQL_LOG::cut_spurious_tail()
{
int error= 0;
- char llbuf1[22], llbuf2[22];
- ulonglong actual_size;
-
DBUG_ENTER("cut_spurious_tail");
+
#ifdef HAVE_INNOBASE_DB
if (have_innodb != SHOW_OPTION_YES)
DBUG_RETURN(0);
@@ -2121,6 +2119,9 @@ bool MYSQL_LOG::cut_spurious_tail()
*/
char *name= ha_innobase::get_mysql_bin_log_name();
ulonglong pos= ha_innobase::get_mysql_bin_log_pos();
+ ulonglong actual_size;
+ char llbuf1[22], llbuf2[22];
+
if (name[0] == 0 || pos == ULONGLONG_MAX)
{
DBUG_PRINT("info", ("InnoDB has not set binlog info"));
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 3b69e1c3176..6207bf1b4dc 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2422,9 +2422,9 @@ void Load_log_event::set_fields(List<Item> &field_list)
int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool use_rli_only_for_errors)
{
+ char *load_data_query= 0;
thd->db= (char*) rewrite_db(db);
DBUG_ASSERT(thd->query == 0);
- thd->query= 0; // Should not be needed
thd->query_length= 0; // Should not be needed
thd->query_error= 0;
clear_all_errors(thd, rli);
@@ -2476,6 +2476,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{
char llbuff[22];
enum enum_duplicates handle_dup;
+ /*
+ Make a simplified LOAD DATA INFILE query, for the information of the
+ user in SHOW PROCESSLIST. Note that db is known in the 'db' column.
+ */
+ if ((load_data_query= (char *) my_alloca(18 + strlen(fname) + 14 +
+ strlen(tables.real_name) + 8)))
+ {
+ thd->query_length= (uint)(strxmov(load_data_query,
+ "LOAD DATA INFILE '", fname,
+ "' INTO TABLE `", tables.real_name,
+ "` <...>", NullS) - load_data_query);
+ thd->query= load_data_query;
+ }
if (sql_ex.opt_flags & REPLACE_FLAG)
handle_dup= DUP_REPLACE;
else if (sql_ex.opt_flags & IGNORE_FLAG)
@@ -2557,9 +2570,14 @@ Slave: load data infile on table '%s' at log position %s in log \
}
thd->net.vio = 0;
- /* Same reason as in Query_log_event::exec_event() */
- thd->db= thd->catalog= 0;
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+ thd->db= thd->catalog= 0;
+ thd->query= 0;
+ thd->query_length= 0;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
close_thread_tables(thd);
+ if (load_data_query)
+ my_afree(load_data_query);
if (thd->query_error)
{
/* this err/sql_errno code is copy-paste from send_error() */
@@ -3114,17 +3132,18 @@ void User_var_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* las
> the string constant is still unescaped according to SJIS, not
> according to UCS2.
*/
- char *p, *q;
- if (!(p= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits per byte
+ char *hex_str;
+ CHARSET_INFO *cs;
+
+ if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte
break; // no error, as we are 'void'
- str_to_hex(p, val, val_len);
+ str_to_hex(hex_str, val, val_len);
/*
For proper behaviour when mysqlbinlog|mysql, we need to explicitely
specify the variable's collation. It will however cause problems when
people want to mysqlbinlog|mysql into another server not supporting the
character set. But there's not much to do about this and it's unlikely.
*/
- CHARSET_INFO *cs;
if (!(cs= get_charset(charset_number, MYF(0))))
/*
Generate an unusable command (=> syntax error) is probably the best
@@ -3132,8 +3151,8 @@ void User_var_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* las
*/
fprintf(file, ":=???;\n");
else
- fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, p, cs->name);
- my_afree(p);
+ fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, hex_str, cs->name);
+ my_afree(hex_str);
}
break;
case ROW_RESULT:
@@ -3601,7 +3620,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
{
- char fname_buf[FN_REFLEN+10];
+ char proc_info[17+FN_REFLEN+10], *fname_buf= proc_info+17;
char *p;
int fd = -1;
IO_CACHE file;
@@ -3610,6 +3629,8 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
bzero((char*)&file, sizeof(file));
p = slave_load_file_stem(fname_buf, file_id, server_id);
strmov(p, ".info"); // strmov takes less code than memcpy
+ strnmov(proc_info, "Making temp file ", 17); // no end 0
+ thd->proc_info= proc_info;
if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC,
MYF(MY_WME))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
@@ -3653,6 +3674,7 @@ err:
end_io_cache(&file);
if (fd >= 0)
my_close(fd, MYF(0));
+ thd->proc_info= 0;
return error ? 1 : Log_event::exec_event(rli);
}
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
@@ -3755,13 +3777,15 @@ void Append_block_log_event::pack_info(Protocol *protocol)
#if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
{
- char fname[FN_REFLEN+10];
+ char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
char *p= slave_load_file_stem(fname, file_id, server_id);
int fd;
int error = 1;
DBUG_ENTER("Append_block_log_event::exec_event");
memcpy(p, ".data", 6);
+ strnmov(proc_info, "Making temp file ", 17); // no end 0
+ thd->proc_info= proc_info;
if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0)
{
slave_print_error(rli,my_errno, "Error in Append_block event: could not open file '%s'", fname);
@@ -3777,6 +3801,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
err:
if (fd >= 0)
my_close(fd, MYF(0));
+ thd->proc_info= 0;
DBUG_RETURN(error ? error : Log_event::exec_event(rli));
}
#endif
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 4c4cf6db4be..fbe8489f7e4 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -675,6 +675,8 @@ int mysqld_show_variables(THD *thd,const char *wild);
int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
enum enum_var_type value_type,
pthread_mutex_t *mutex);
+int mysql_find_files(THD *thd,List<char> *files, const char *db,
+ const char *path, const char *wild, bool dir);
int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_collations(THD *thd,const char *wild);
int mysqld_show_storage_engines(THD *thd);
@@ -844,6 +846,9 @@ bool is_keyword(const char *name, uint len);
#define MY_DB_OPT_FILE "db.opt"
bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
+bool my_dbopt_init(void);
+void my_dbopt_cleanup(void);
+void my_dbopt_free(void);
/*
External variables
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 564a8090b23..9e14ec490f6 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -890,6 +890,7 @@ extern "C" void unireg_abort(int exit_code)
}
#endif
+
void clean_up(bool print_message)
{
DBUG_PRINT("exit",("clean_up"));
@@ -905,6 +906,7 @@ void clean_up(bool print_message)
bitmap_free(&slave_error_mask);
#endif
my_tz_free();
+ my_dbopt_free();
#ifndef NO_EMBEDDED_ACCESS_CHECKS
acl_free(1);
grant_free();
@@ -1303,6 +1305,19 @@ void yyerror(const char *s)
#ifndef EMBEDDED_LIBRARY
+/*
+ Close a connection
+
+ SYNOPSIS
+ close_connection()
+ thd Thread handle
+ errcode Error code to print to console
+ lock 1 if we have have to lock LOCK_thread_count
+
+ NOTES
+ For the connection that is doing shutdown, this is called twice
+*/
+
void close_connection(THD *thd, uint errcode, bool lock)
{
st_vio *vio;
@@ -2282,7 +2297,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
*/
global_system_variables.time_zone= my_tz_SYSTEM;
-
/*
Init mutexes for the global MYSQL_LOG objects.
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
@@ -2388,6 +2402,9 @@ static int init_common_variables(const char *conf_file_name, int argc,
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
+ if (my_dbopt_init())
+ return 1;
+
return 0;
}
@@ -4755,26 +4772,26 @@ log and this option does nothing anymore.",
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
(gptr*) &dflt_key_cache_var.param_buff_size,
(gptr*) 0,
- 0, (enum get_opt_var_type) (GET_ULL | GET_ASK_ADDR),
+ 0, (GET_ULL | GET_ASK_ADDR),
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD,
IO_SIZE, 0},
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
"The default size of key cache blocks",
(gptr*) &dflt_key_cache_var.param_block_size,
(gptr*) 0,
- 0, (enum get_opt_var_type) (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
+ 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
KEY_CACHE_BLOCK_SIZE , 512, 1024*16, MALLOC_OVERHEAD, 512, 0},
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
"The minimum percentage of warm blocks in key cache",
(gptr*) &dflt_key_cache_var.param_division_limit,
(gptr*) 0,
- 0, (enum get_opt_var_type) (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
+ 0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
1, 100, 0, 1, 0},
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
(gptr*) &dflt_key_cache_var.param_age_threshold,
(gptr*) 0,
- 0, (enum get_opt_var_type) (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
+ 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
300, 100, ~0L, 0, 100, 0},
{"long_query_time", OPT_LONG_QUERY_TIME,
"Log all queries that have taken more than long_query_time seconds to execute to file.",
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 9c1d5208bbd..68360f91191 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -343,7 +343,7 @@ typedef struct st_qsel_param {
uint *imerge_cost_buff; /* buffer for index_merge cost estimates */
uint imerge_cost_buff_size; /* size of the buffer */
- /* true if last checked tree->key can be used for ROR-scan */
+ /* TRUE if last checked tree->key can be used for ROR-scan */
bool is_ror_scan;
} PARAM;
@@ -585,7 +585,7 @@ inline void imerge_list_and_list(List<SEL_IMERGE> *im1, List<SEL_IMERGE> *im2)
i.e. all conjuncts except the first one are currently dropped.
This is done to avoid producing N*K ways to do index_merge.
- If (a_1||b_1) produce a condition that is always true, NULL is returned
+ If (a_1||b_1) produce a condition that is always TRUE, NULL is returned
and index_merge is discarded (while it is actually possible to try
harder).
@@ -848,7 +848,7 @@ int QUICK_ROR_INTERSECT_SELECT::init()
SYNOPSIS
QUICK_RANGE_SELECT::init_ror_merged_scan()
- reuse_handler If true, use head->file, otherwise create a separate
+ reuse_handler If TRUE, use head->file, otherwise create a separate
handler object
NOTES
@@ -906,7 +906,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
file->close();
goto failure;
}
- free_file= true;
+ free_file= TRUE;
last_rowid= file->ref;
DBUG_RETURN(0);
@@ -920,7 +920,7 @@ failure:
Initialize this quick select to be a part of a ROR-merged scan.
SYNOPSIS
QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan()
- reuse_handler If true, use head->file, otherwise create separate
+ reuse_handler If TRUE, use head->file, otherwise create separate
handler object.
RETURN
0 OK
@@ -941,13 +941,13 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
There is no use of this->file. Use it for the first of merged range
selects.
*/
- if (quick->init_ror_merged_scan(true))
+ if (quick->init_ror_merged_scan(TRUE))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
}
while((quick= quick_it++))
{
- if (quick->init_ror_merged_scan(false))
+ if (quick->init_ror_merged_scan(FALSE))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
/* All merged scans share the same record buffer in intersection. */
@@ -976,7 +976,7 @@ int QUICK_ROR_INTERSECT_SELECT::reset()
{
int result;
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset");
- result= init_ror_merged_scan(true);
+ result= init_ror_merged_scan(TRUE);
DBUG_RETURN(result);
}
@@ -992,8 +992,8 @@ int QUICK_ROR_INTERSECT_SELECT::reset()
This call can only be made before init() is called.
RETURN
- false OK
- true Out of memory.
+ FALSE OK
+ TRUE Out of memory.
*/
bool
@@ -1037,7 +1037,7 @@ QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT(THD *thd_param,
int QUICK_ROR_UNION_SELECT::init()
{
if (init_queue(&queue, quick_selects.elements, 0,
- false , QUICK_ROR_UNION_SELECT::queue_cmp,
+ FALSE , QUICK_ROR_UNION_SELECT::queue_cmp,
(void*) this))
{
bzero(&queue, sizeof(QUEUE));
@@ -1084,7 +1084,7 @@ int QUICK_ROR_UNION_SELECT::reset()
QUICK_SELECT_I* quick;
int error;
DBUG_ENTER("QUICK_ROR_UNION_SELECT::reset");
- have_prev_rowid= false;
+ have_prev_rowid= FALSE;
/*
Initialize scans for merged quick selects and put all merged quick
selects into the queue.
@@ -1092,7 +1092,7 @@ int QUICK_ROR_UNION_SELECT::reset()
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
- if (quick->init_ror_merged_scan(false))
+ if (quick->init_ror_merged_scan(FALSE))
DBUG_RETURN(1);
if ((error= quick->get_next()))
{
@@ -1310,7 +1310,7 @@ public:
ha_rows records; /* estimate of #rows to be examined */
/*
- If true, the scan returns rows in rowid order. This is used only for
+ If TRUE, the scan returns rows in rowid order. This is used only for
scans that can be both ROR and non-ROR.
*/
bool is_ror;
@@ -1320,7 +1320,7 @@ public:
SYNOPSIS
make_quick()
param Parameter from test_quick_select
- retrieve_full_rows If true, created quick select will do full record
+ retrieve_full_rows If TRUE, created quick select will do full record
retrieval.
parent_alloc Memory pool to use, if any.
@@ -1390,7 +1390,7 @@ public:
struct st_ror_scan_info **first_scan;
struct st_ror_scan_info **last_scan; /* End of the above array */
struct st_ror_scan_info *cpk_scan; /* Clustered PK scan, if there is one */
- bool is_covering; /* true if no row retrieval phase is necessary */
+ bool is_covering; /* TRUE if no row retrieval phase is necessary */
double index_scan_costs; /* SUM(cost(index_scan)) */
};
@@ -1449,7 +1449,7 @@ static int fill_used_fields_bitmap(PARAM *param)
uint pk;
if (!(tmp= (uchar*)alloc_root(param->mem_root,param->fields_bitmap_size)) ||
bitmap_init(&param->needed_fields, tmp, param->fields_bitmap_size*8,
- false))
+ FALSE))
return 1;
bitmap_clear_all(&param->needed_fields);
@@ -1644,10 +1644,10 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
{
double best_read_time= read_time;
TRP_ROR_INTERSECT *new_trp;
- bool can_build_covering= false;
+ bool can_build_covering= FALSE;
/* Get best 'range' plan and prepare data for making other plans */
- if ((best_trp= get_key_scans_params(&param, tree, false,
+ if ((best_trp= get_key_scans_params(&param, tree, FALSE,
best_read_time)))
best_read_time= best_trp->read_cost;
@@ -1705,7 +1705,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
if (best_trp)
{
records= best_trp->records;
- if (!(quick= best_trp->make_quick(&param, true)) || quick->init())
+ if (!(quick= best_trp->make_quick(&param, TRUE)) || quick->init())
{
delete quick;
quick= NULL;
@@ -1858,13 +1858,13 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
TRP_RANGE **range_scans;
TRP_RANGE **cur_child;
TRP_RANGE **cpk_scan= NULL;
- bool imerge_too_expensive= false;
+ bool imerge_too_expensive= FALSE;
double imerge_cost= 0.0;
ha_rows cpk_scan_records= 0;
ha_rows non_cpk_scan_records= 0;
bool pk_is_clustered= param->table->file->primary_key_is_clustered();
- bool all_scans_ror_able= true;
- bool all_scans_rors= true;
+ bool all_scans_ror_able= TRUE;
+ bool all_scans_rors= TRUE;
uint unique_calc_buff_size;
TABLE_READ_PLAN **roru_read_plans;
TABLE_READ_PLAN **cur_roru_plan;
@@ -1891,7 +1891,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
{
DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map,
"tree in SEL_IMERGE"););
- if (!(*cur_child= get_key_scans_params(param, *ptree, true, read_time)))
+ if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, read_time)))
{
/*
One of index scans in this index_merge is more expensive than entire
@@ -1899,7 +1899,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
any possible ROR-union) will be more expensive then, too. We continue
here only to update SQL_SELECT members.
*/
- imerge_too_expensive= true;
+ imerge_too_expensive= TRUE;
}
if (imerge_too_expensive)
continue;
@@ -2170,7 +2170,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
DBUG_RETURN(NULL);
if (bitmap_init(&ror_scan->covered_fields, bitmap_buf,
- param->fields_bitmap_size*8, false))
+ param->fields_bitmap_size*8, FALSE))
DBUG_RETURN(NULL);
bitmap_clear_all(&ror_scan->covered_fields);
@@ -2251,7 +2251,7 @@ typedef struct
const PARAM *param;
MY_BITMAP covered_fields; /* union of fields covered by all scans */
- /* true if covered_fields is a superset of needed_fields */
+ /* TRUE if covered_fields is a superset of needed_fields */
bool is_covering;
double index_scan_costs; /* SUM(cost of 'index-only' scans) */
@@ -2274,7 +2274,7 @@ typedef struct
static void ror_intersect_reinit(ROR_INTERSECT_INFO *info)
{
- info->is_covering= false;
+ info->is_covering= FALSE;
info->index_scan_costs= 0.0f;
info->records_fract= 1.0f;
bitmap_clear_all(&info->covered_fields);
@@ -2286,7 +2286,7 @@ static void ror_intersect_reinit(ROR_INTERSECT_INFO *info)
SYNOPSIS
ror_intersect_init()
param Parameter from test_quick_select
- is_index_only If true, set ROR_INTERSECT_INFO to be covering
+ is_index_only If TRUE, set ROR_INTERSECT_INFO to be covering
RETURN
allocated structure
@@ -2305,7 +2305,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param, bool is_index_only)
if (!(buf= (uchar*)alloc_root(param->mem_root, param->fields_bitmap_size)))
return NULL;
if (bitmap_init(&info->covered_fields, buf, param->fields_bitmap_size*8,
- false))
+ FALSE))
return NULL;
ror_intersect_reinit(info);
return info;
@@ -2322,7 +2322,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param, bool is_index_only)
param Parameter from test_quick_select
info ROR-intersection structure to add the scan to.
ror_scan ROR scan info to add.
- is_cpk_scan If true, add the scan as CPK scan (this can be inferred
+ is_cpk_scan If TRUE, add the scan as CPK scan (this can be inferred
from other parameters and is passed separately only to
avoid duplicating the inference code)
@@ -2420,12 +2420,12 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param, bool is_index_only)
and reduce adjacent fractions.
RETURN
- true ROR scan added to ROR-intersection, cost updated.
- false It doesn't make sense to add this ROR scan to this ROR-intersection.
+ TRUE ROR scan added to ROR-intersection, cost updated.
+ FALSE It doesn't make sense to add this ROR scan to this ROR-intersection.
*/
bool ror_intersect_add(const PARAM *param, ROR_INTERSECT_INFO *info,
- ROR_SCAN_INFO* ror_scan, bool is_cpk_scan=false)
+ ROR_SCAN_INFO* ror_scan, bool is_cpk_scan=FALSE)
{
int i;
SEL_ARG *sel_arg;
@@ -2504,7 +2504,7 @@ bool ror_intersect_add(const PARAM *param, ROR_INTERSECT_INFO *info,
{
/* Don't add this scan if it doesn't improve selectivity. */
DBUG_PRINT("info", ("The scan doesn't improve selectivity."));
- DBUG_RETURN(false);
+ DBUG_RETURN(FALSE);
}
info->records_fract *= selectivity_mult;
@@ -2525,7 +2525,7 @@ bool ror_intersect_add(const PARAM *param, ROR_INTERSECT_INFO *info,
&info->covered_fields))
{
DBUG_PRINT("info", ("ROR-intersect is covering now"));
- info->is_covering= true;
+ info->is_covering= TRUE;
}
info->total_cost= info->index_scan_costs;
@@ -2539,7 +2539,7 @@ bool ror_intersect_add(const PARAM *param, ROR_INTERSECT_INFO *info,
DBUG_PRINT("info", ("New selectivity= %g", info->records_fract));
DBUG_PRINT("info", ("New cost= %g, %scovering", info->total_cost,
info->is_covering?"" : "non-"));
- DBUG_RETURN(true);
+ DBUG_RETURN(TRUE);
}
@@ -2553,7 +2553,7 @@ bool ror_intersect_add(const PARAM *param, ROR_INTERSECT_INFO *info,
tree Transformed restriction condition to be used to look
for ROR scans.
read_time Do not return read plans with cost > read_time.
- are_all_covering [out] set to true if union of all scans covers all
+ are_all_covering [out] set to TRUE if union of all scans covers all
fields needed by the query (and it is possible to build
a covering ROR-intersection)
@@ -2621,7 +2621,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
*/
ROR_SCAN_INFO **cur_ror_scan;
ROR_SCAN_INFO *cpk_scan= NULL;
- bool cpk_scan_used= false;
+ bool cpk_scan_used= FALSE;
if (!(tree->ror_scans= (ROR_SCAN_INFO**)alloc_root(param->mem_root,
sizeof(ROR_SCAN_INFO*)*
param->keys)))
@@ -2670,7 +2670,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
/* Create and incrementally update ROR intersection. */
ROR_INTERSECT_INFO *intersect;
- if (!(intersect= ror_intersect_init(param, false)))
+ if (!(intersect= ror_intersect_init(param, FALSE)))
return NULL;
/* [intersect_scans, intersect_scans_best) will hold the best combination */
@@ -2739,7 +2739,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
if (ror_intersect_add(param, intersect, cpk_scan))
{
- cpk_scan_used= true;
+ cpk_scan_used= TRUE;
min_cost= intersect->total_cost;
best_rows= (ha_rows)(intersect->records_fract*
rows2double(param->table->file->records));
@@ -2826,7 +2826,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
uchar buf[MAX_KEY/8+1];
MY_BITMAP covered_fields;
- if (bitmap_init(&covered_fields, buf, nbits, false))
+ if (bitmap_init(&covered_fields, buf, nbits, FALSE))
DBUG_RETURN(0);
bitmap_clear_all(&covered_fields);
@@ -2903,7 +2903,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
DBUG_RETURN(NULL);
memcpy(trp->first_scan, ror_scan_mark, best_num*sizeof(ROR_SCAN_INFO*));
trp->last_scan= trp->first_scan + best_num;
- trp->is_covering= true;
+ trp->is_covering= TRUE;
trp->read_cost= total_cost;
trp->records= records;
@@ -2918,7 +2918,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
get_key_scans_params
param parameters from test_quick_select
tree make range select for this SEL_TREE
- index_read_must_be_used if true, assume 'index only' option will be set
+ index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes)
read_time don't create read plans with cost > read_time.
RETURN
@@ -2959,8 +2959,8 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
(*key)->maybe_flag)
param->needed_reg->set_bit(keynr);
- bool read_index_only= index_read_must_be_used? true :
- (bool)param->table->used_keys.is_set(keynr);
+ bool read_index_only= index_read_must_be_used ? TRUE :
+ (bool) param->table->used_keys.is_set(keynr);
found_records= check_quick_select(param, idx, *key);
if (param->is_ror_scan)
@@ -2970,7 +2970,8 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
}
if (found_records != HA_POS_ERROR && found_records > 2 &&
read_index_only &&
- (param->table->file->index_flags(keynr) & HA_KEYREAD_ONLY) &&
+ (param->table->file->index_flags(keynr, param.max_key_part,1) &
+ HA_KEYREAD_ONLY) &&
!(pk_is_clustered && keynr == param->table->primary_key))
{
/* We can resolve this by only reading through this key. */
@@ -3038,7 +3039,7 @@ QUICK_SELECT_I *TRP_INDEX_MERGE::make_quick(PARAM *param,
range_scan++)
{
if (!(quick= (QUICK_RANGE_SELECT*)
- ((*range_scan)->make_quick(param, false, &quick_imerge->alloc)))||
+ ((*range_scan)->make_quick(param, FALSE, &quick_imerge->alloc)))||
quick_imerge->push_quick_back(quick))
{
delete quick;
@@ -3060,7 +3061,7 @@ QUICK_SELECT_I *TRP_ROR_INTERSECT::make_quick(PARAM *param,
if ((quick_intrsect=
new QUICK_ROR_INTERSECT_SELECT(param->thd, param->table,
- retrieve_full_rows? (!is_covering):false,
+ retrieve_full_rows? (!is_covering):FALSE,
parent_alloc)))
{
DBUG_EXECUTE("info", print_ror_scans_arr(param->table,
@@ -3110,7 +3111,7 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
{
for(scan= first_ror; scan != last_ror; scan++)
{
- if (!(quick= (*scan)->make_quick(param, false, &quick_roru->alloc)) ||
+ if (!(quick= (*scan)->make_quick(param, FALSE, &quick_roru->alloc)) ||
quick_roru->push_quick_back(quick))
DBUG_RETURN(NULL);
}
@@ -3231,7 +3232,7 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
param->current_table))
DBUG_RETURN(0); // Can't be calculated yet
if (!(ref_tables & param->current_table))
- DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true
+ DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be FALSE or TRUE
/* check field op const */
/* btw, ft_func's arguments()[0] isn't FIELD_ITEM. SerG*/
@@ -3372,7 +3373,8 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
uint length,offset,min_length,max_length;
- if (!field->optimize_range(param->real_keynr[key_part->key]))
+ if (!field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part))
DBUG_RETURN(0); // Can't optimize this
if (!(res= value->val_str(&tmp)))
DBUG_RETURN(&null_element);
@@ -3437,7 +3439,8 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
DBUG_RETURN(new SEL_ARG(field,min_str,max_str));
}
- if (!field->optimize_range(param->real_keynr[key_part->key]) &&
+ if (!field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part) &&
type != Item_func::EQ_FUNC &&
type != Item_func::EQUAL_FUNC)
DBUG_RETURN(0); // Can't optimize this
@@ -3454,7 +3457,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
if (value->save_in_field(field, 1) < 0)
{
/* This happens when we try to insert a NULL field in a not null column */
- DBUG_RETURN(&null_element); // cmp with NULL is never true
+ DBUG_RETURN(&null_element); // cmp with NULL is never TRUE
}
/* Get local copy of key */
copies= 1;
@@ -3559,8 +3562,8 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
** If tree is 0 it means that the condition can't be tested. It refers
** to a non existent table or to a field in current table with isn't a key.
** The different tree flags:
-** IMPOSSIBLE: Condition is never true
-** ALWAYS: Condition is always true
+** IMPOSSIBLE: Condition is never TRUE
+** ALWAYS: Condition is always TRUE
** MAYBE: Condition may exists when tables are read
** MAYBE_KEY: Condition refers to a key that may be used in join loop
** KEY_RANGE: Condition uses a key
@@ -3683,7 +3686,7 @@ bool sel_trees_can_be_ored(SEL_TREE *tree1, SEL_TREE *tree2, PARAM* param)
common_keys.intersect(tree2->keys_map);
if (common_keys.is_clear_all())
- DBUG_RETURN(false);
+ DBUG_RETURN(FALSE);
/* trees have a common key, check if they refer to same key part */
SEL_ARG **key1,**key2;
@@ -3695,11 +3698,11 @@ bool sel_trees_can_be_ored(SEL_TREE *tree1, SEL_TREE *tree2, PARAM* param)
key2= tree2->keys + key_no;
if ((*key1)->part == (*key2)->part)
{
- DBUG_RETURN(true);
+ DBUG_RETURN(TRUE);
}
}
}
- DBUG_RETURN(false);
+ DBUG_RETURN(FALSE);
}
static SEL_TREE *
@@ -4669,7 +4672,7 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
uint key;
DBUG_ENTER("check_quick_select");
- param->is_ror_scan= false;
+ param->is_ror_scan= FALSE;
if (!tree)
DBUG_RETURN(HA_POS_ERROR); // Can't use it
@@ -4686,7 +4689,7 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
if ((key_alg != HA_KEY_ALG_BTREE) && (key_alg!= HA_KEY_ALG_UNDEF))
{
/* Records are not ordered by rowid for other types of indexes. */
- cpk_scan= false;
+ cpk_scan= FALSE;
}
else
{
@@ -4707,7 +4710,7 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
param->table->quick_key_parts[key]=param->max_key_part+1;
if (cpk_scan)
- param->is_ror_scan= true;
+ param->is_ror_scan= TRUE;
}
DBUG_PRINT("exit", ("Records: %lu", (ulong) records));
DBUG_RETURN(records);
@@ -4766,7 +4769,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
(keyXpartY less/equals c1) OR (keyXpartY more/equals c2).
This is not a ROR scan if the key is not Clustered Primary Key.
*/
- param->is_ror_scan= false;
+ param->is_ror_scan= FALSE;
records=check_quick_keys(param,idx,key_tree->left,min_key,min_key_flag,
max_key,max_key_flag);
if (records == HA_POS_ERROR) // Impossible
@@ -4791,7 +4794,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
key_part[key_tree->part].fieldnr - 1;
if (param->table->field[fieldnr]->key_length() !=
param->key[idx][key_tree->part].length)
- param->is_ror_scan= false;
+ param->is_ror_scan= FALSE;
}
if (key_tree->next_key_part &&
@@ -4810,7 +4813,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
else
{
/* The interval for current key part is not c1 <= keyXpartY <= c1 */
- param->is_ror_scan= false;
+ param->is_ror_scan= FALSE;
}
tmp_min_flag=key_tree->min_flag;
@@ -4856,7 +4859,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
!memcmp(min_key,max_key, (uint) (tmp_max_key - max_key)) &&
!key_tree->min_flag && !key_tree->max_flag &&
is_key_scan_ror(param, keynr, key_tree->part + 1)))
- param->is_ror_scan= false;
+ param->is_ror_scan= FALSE;
}
if (tmp_min_flag & GEOM_FLAG)
@@ -4901,7 +4904,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
(keyXpartY less/equals c1) OR (keyXpartY more/equals c2).
This is not a ROR scan if the key is not Clustered Primary Key.
*/
- param->is_ror_scan= false;
+ param->is_ror_scan= FALSE;
tmp=check_quick_keys(param,idx,key_tree->right,min_key,min_key_flag,
max_key,max_key_flag);
if (tmp == HA_POS_ERROR)
@@ -4947,8 +4950,8 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
Check (2) is made by this function.
RETURN
- true If the scan is ROR-scan
- false otherwise
+ TRUE If the scan is ROR-scan
+ FALSE otherwise
*/
static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
@@ -4959,10 +4962,10 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
table_key->key_parts;
if (key_part == key_part_end)
- return true;
+ return TRUE;
uint pk_number= param->table->primary_key;
if (!param->table->file->primary_key_is_clustered() || pk_number == MAX_KEY)
- return false;
+ return FALSE;
KEY_PART_INFO *pk_part= param->table->key_info[pk_number].key_part;
KEY_PART_INFO *pk_part_end= pk_part +
@@ -4972,7 +4975,7 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
{
if ((key_part->field != pk_part->field) ||
(key_part->length != pk_part->length))
- return false;
+ return FALSE;
}
return (key_part == key_part_end);
}
@@ -5173,7 +5176,7 @@ bool QUICK_RANGE_SELECT::unique_key_range()
}
-/* Returns true if any part of the key is NULL */
+/* Returns TRUE if any part of the key is NULL */
static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length)
{
@@ -5311,7 +5314,7 @@ err:
/*
Fetch all row ids into unique.
- If table has a clustered primary key that covers all rows (true for bdb
+ If table has a clustered primary key that covers all rows (TRUE for bdb
and innodb currently) and one of the index_merge scans is a scan on PK,
then
primary key scan rowids are not put into Unique and also
@@ -5380,11 +5383,11 @@ int QUICK_INDEX_MERGE_SELECT::prepare_unique()
if (result)
DBUG_RETURN(1);
- }while(true);
+ }while(TRUE);
/* ok, all row ids are in Unique */
result= unique->get(head);
- doing_pk_scan= false;
+ doing_pk_scan= FALSE;
init_read_record(&read_record, thd, head, NULL, 1, 1);
/* index_merge currently doesn't support "using index" at all */
head->file->extra(HA_EXTRA_NO_KEYREAD);
@@ -5419,7 +5422,7 @@ int QUICK_INDEX_MERGE_SELECT::get_next()
/* All rows from Unique have been retrieved, do a clustered PK scan */
if(pk_quick_select)
{
- doing_pk_scan= true;
+ doing_pk_scan= TRUE;
if ((result= pk_quick_select->init()))
DBUG_RETURN(result);
DBUG_RETURN(pk_quick_select->get_next());
@@ -5567,8 +5570,8 @@ int QUICK_ROR_UNION_SELECT::get_next()
if (!have_prev_rowid)
{
/* No rows have been returned yet */
- dup_row= false;
- have_prev_rowid= true;
+ dup_row= FALSE;
+ have_prev_rowid= TRUE;
}
else
dup_row= !head->file->cmp_ref(cur_rowid, prev_rowid);
@@ -5691,8 +5694,8 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
index_merge quick select.
RETURN
- true if current row will be retrieved by this quick select
- false if not
+ TRUE if current row will be retrieved by this quick select
+ FALSE if not
*/
bool QUICK_RANGE_SELECT::row_in_ranges()
@@ -5889,7 +5892,7 @@ int QUICK_RANGE_SELECT::cmp_prev(QUICK_RANGE *range_arg)
/*
- * True if this range will require using HA_READ_AFTER_KEY
+ * TRUE if this range will require using HA_READ_AFTER_KEY
See comment in get_next() about this
*/
@@ -5901,7 +5904,7 @@ bool QUICK_SELECT_DESC::range_reads_after_key(QUICK_RANGE *range_arg)
}
-/* True if we are reading over a key that may have a NULL value */
+/* TRUE if we are reading over a key that may have a NULL value */
#ifdef NOT_USED
bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg,
@@ -5958,7 +5961,7 @@ void QUICK_RANGE_SELECT::add_info_string(String *str)
void QUICK_INDEX_MERGE_SELECT::add_info_string(String *str)
{
QUICK_RANGE_SELECT *quick;
- bool first= true;
+ bool first= TRUE;
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
str->append("sort_union(");
while ((quick= it++))
@@ -5966,7 +5969,7 @@ void QUICK_INDEX_MERGE_SELECT::add_info_string(String *str)
if (!first)
str->append(',');
else
- first= false;
+ first= FALSE;
quick->add_info_string(str);
}
if (pk_quick_select)
@@ -5979,7 +5982,7 @@ void QUICK_INDEX_MERGE_SELECT::add_info_string(String *str)
void QUICK_ROR_INTERSECT_SELECT::add_info_string(String *str)
{
- bool first= true;
+ bool first= TRUE;
QUICK_RANGE_SELECT *quick;
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
str->append("intersect(");
@@ -5989,7 +5992,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_info_string(String *str)
if (!first)
str->append(',');
else
- first= false;
+ first= FALSE;
str->append(key_info->name);
}
if (cpk_quick)
@@ -6003,7 +6006,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_info_string(String *str)
void QUICK_ROR_UNION_SELECT::add_info_string(String *str)
{
- bool first= true;
+ bool first= TRUE;
QUICK_SELECT_I *quick;
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
str->append("union(");
@@ -6012,7 +6015,7 @@ void QUICK_ROR_UNION_SELECT::add_info_string(String *str)
if (!first)
str->append(',');
else
- first= false;
+ first= FALSE;
quick->add_info_string(str);
}
str->append(')');
@@ -6035,14 +6038,14 @@ void QUICK_INDEX_MERGE_SELECT::add_keys_and_lengths(String *key_names,
{
char buf[64];
uint length;
- bool first= true;
+ bool first= TRUE;
QUICK_RANGE_SELECT *quick;
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
while ((quick= it++))
{
if (first)
- first= false;
+ first= FALSE;
else
{
key_names->append(',');
@@ -6070,14 +6073,14 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names,
{
char buf[64];
uint length;
- bool first= true;
+ bool first= TRUE;
QUICK_RANGE_SELECT *quick;
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
while ((quick= it++))
{
KEY *key_info= head->key_info + quick->index;
if (first)
- first= false;
+ first= FALSE;
else
{
key_names->append(',');
@@ -6102,13 +6105,13 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names,
void QUICK_ROR_UNION_SELECT::add_keys_and_lengths(String *key_names,
String *used_lengths)
{
- bool first= true;
+ bool first= TRUE;
QUICK_SELECT_I *quick;
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
if (first)
- first= false;
+ first= FALSE;
else
{
used_lengths->append(',');
@@ -6222,7 +6225,7 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg)
DBUG_VOID_RETURN;
DBUG_LOCK_FILE;
- quick->dbug_dump(0, true);
+ quick->dbug_dump(0, TRUE);
fprintf(DBUG_FILE,"other_keys: 0x%s:\n", needed_reg->print(buf));
DBUG_UNLOCK_FILE;
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 75b00b97ce7..f4c39462d0c 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -629,7 +629,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
if (!(field->flags & PART_KEY_FLAG))
return 0; // Not key field
*prefix_len= 0;
-
+
TABLE *table= field->table;
uint idx= 0;
@@ -637,16 +637,17 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
for (keyinfo= table->key_info, keyinfo_end= keyinfo+table->keys ;
keyinfo != keyinfo_end;
keyinfo++,idx++)
- {
- if (!(table->file->index_flags(idx) & HA_READ_ORDER))
- break;
-
+ {
KEY_PART_INFO *part,*part_end;
key_part_map key_part_to_use= 0;
+ uint jdx= 0;
for (part= keyinfo->key_part, part_end= part+keyinfo->key_parts ;
part != part_end ;
- part++, key_part_to_use= (key_part_to_use << 1) | 1)
+ part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)
{
+ if (!(table->file->index_flags(idx, jdx, 0) & HA_READ_ORDER))
+ return 0;
+
if (field->eq(part->field))
{
ref->key= idx;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 1066c6f4465..07ab6620e4b 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -813,6 +813,9 @@ struct show_var_st init_vars[]= {
{sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS},
#endif
{sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS},
+#ifdef HAVE_TZNAME
+ {"system_time_zone", system_time_zone, SHOW_CHAR},
+#endif
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
{sys_table_type.name, (char*) &sys_table_type, SHOW_SYS},
{sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS},
@@ -821,9 +824,6 @@ struct show_var_st init_vars[]= {
#endif
{"thread_stack", (char*) &thread_stack, SHOW_LONG},
{sys_time_format.name, (char*) &sys_time_format, SHOW_SYS},
-#ifdef HAVE_TZNAME
- {"system_time_zone", system_time_zone, SHOW_CHAR},
-#endif
{"time_zone", (char*) &sys_time_zone, SHOW_SYS},
{sys_tmp_table_size.name, (char*) &sys_tmp_table_size, SHOW_SYS},
{"tmpdir", (char*) &opt_mysql_tmpdir, SHOW_CHAR_PTR},
@@ -1755,10 +1755,10 @@ bool sys_var_collation::check(THD *thd, set_var *var)
}
else // INT_RESULT
{
- if (!(tmp=get_charset(var->value->val_int(),MYF(0))))
+ if (!(tmp=get_charset((int) var->value->val_int(),MYF(0))))
{
char buf[20];
- int10_to_str(var->value->val_int(), buf, -10);
+ int10_to_str((int) var->value->val_int(), buf, -10);
my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
return 1;
}
@@ -1794,10 +1794,10 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
}
else // INT_RESULT
{
- if (!(tmp=get_charset(var->value->val_int(),MYF(0))))
+ if (!(tmp=get_charset((int) var->value->val_int(),MYF(0))))
{
char buf[20];
- int10_to_str(var->value->val_int(), buf, -10);
+ int10_to_str((int) var->value->val_int(), buf, -10);
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), buf);
return 1;
}
diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml
index 44eb6f386d4..5e75cde5f2a 100644
--- a/sql/share/charsets/Index.xml
+++ b/sql/share/charsets/Index.xml
@@ -402,7 +402,7 @@ To make maintaining easier please:
<description>ARMSCII-8 Armenian</description>
<alias>armscii-8</alias>
<collation name="armscii8_general_ci" id="32" order="Armenian" flag="primary"/>
- <collation name="armscii_bin" id="64" order="Binary" flag="binary"/>
+ <collation name="armscii8_bin" id="64" order="Binary" flag="binary"/>
</charset>
<charset name="utf8">
diff --git a/sql/share/charsets/armscii8.xml b/sql/share/charsets/armscii8.xml
index 1d9e33e3bc8..8ca5675012b 100644
--- a/sql/share/charsets/armscii8.xml
+++ b/sql/share/charsets/armscii8.xml
@@ -114,7 +114,7 @@
</map>
</collation>
-<collation name="armscii_bin" flag="binary"/>
+<collation name="armscii8_bin" flag="binary"/>
</charset>
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 75cbf12f60c..8ca63ce2105 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -312,6 +312,7 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index b4b42b41969..4c61f0449ab 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -306,6 +306,7 @@ character-set=latin1
"Modtog temporary fejl %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index af0c3a1bc0b..673678543b1 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -314,6 +314,7 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 7706257a55d..4e0d7392947 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -303,6 +303,7 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index ace966b693a..6438934cdda 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -308,6 +308,7 @@ character-set=latin7
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 63568b9ebd7..c4957433a8c 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -303,6 +303,7 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index d2588b10092..0d6eb180abd 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -315,6 +315,7 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 2d099e149f6..6a1c6b99c25 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -303,6 +303,7 @@ character-set=greek
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index ac9539b35cf..f9391613018 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -305,6 +305,7 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 33ea2cb2a9d..525fd7eced9 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -303,6 +303,7 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 6bb82cc9749..fdff7cff4e3 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -304,7 +304,8 @@ character-set=ujis
"Got NDB error %d '%-.100s'",
"Got temporary NDB error %d '%-.100s'",
"Unknown or incorrect time zone: '%-.64s'",
-+ "Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 884ce735815..ee038dd9ec6 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -303,6 +303,7 @@ character-set=euckr
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 27ebe984c7e..10cb75fdb7b 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -305,6 +305,7 @@ character-set=latin1
"Mottok temporary feil %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 764032da9da..d17c12c13e3 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -305,6 +305,7 @@ character-set=latin1
"Mottok temporary feil %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 68464d0b8f1..38d707d9174 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -307,6 +307,7 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 7561f12cb7c..391c10c8bbc 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -304,6 +304,7 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 03dd45fb6c2..8cc218f3831 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -307,6 +307,7 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index 3b0286ea3f8..b317265f9ac 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -305,6 +305,7 @@ character-set=koi8r
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index a64d9056701..6a5b24666c3 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -309,6 +309,7 @@ character-set=cp1250
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index ebd64f34f88..ba851763bf6 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -311,6 +311,7 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 042df901a5e..fe19bdbb7ac 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -301,6 +301,11 @@ character-set=latin1
"Incorrecta definición de tabla; Solamente debe haber una columna TIMESTAMP con CURRENT_TIMESTAMP en DEFAULT o ON UPDATE cláusula"
"Inválido ON UPDATE cláusula para campo '%-.64s'",
"This command is not supported in the prepared statement protocol yet",
+"Got error %d '%-.100s' from %s",
+"Got temporary error %d '%-.100s' from %s",
+"Unknown or incorrect time zone: '%-.64s'",
+"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 26e00bfbcca..3a616479dba 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -299,6 +299,11 @@ character-set=latin1
"Incorrect table definition; There can only be one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"
"Invalid ON UPDATE clause for '%-.64s' field",
"This command is not supported in the prepared statement protocol yet",
+"Got error %d '%-.100s' from %s",
+"Got temporary error %d '%-.100s' from %s",
+"Unknown or incorrect time zone: '%-.64s'",
+"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 05fcb3d3121..1aeba953e8f 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -304,6 +304,11 @@ character-set=koi8u
"Incorrect table definition; There can only be one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"
"Invalid ON UPDATE clause for '%-.64s' field",
"This command is not supported in the prepared statement protocol yet",
+"Got error %d '%-.100s' from %s",
+"Got temporary error %d '%-.100s' from %s",
+"Unknown or incorrect time zone: '%-.64s'",
+"Invalid TIMESTAMP value in column '%s' at row %ld",
+"Invalid %s character string: '%.64s'",
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 36926d4526d..810312dea16 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1869,11 +1869,13 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
col_privs->field[3]->pack_length());
key_copy(key,col_privs,0,key_len);
col_privs->field[4]->store("",0, &my_charset_latin1);
- if (col_privs->file->index_read_idx(col_privs->record[0],0,
+ col_privs->file->ha_index_init(0);
+ if (col_privs->file->index_read(col_privs->record[0],
(byte*) col_privs->field[0]->ptr,
key_len, HA_READ_KEY_EXACT))
{
cols = 0; /* purecov: deadcode */
+ col_privs->file->ha_index_end();
return;
}
do
@@ -1893,6 +1895,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
my_hash_insert(&hash_columns, (byte *) mem_check);
} while (!col_privs->file->index_next(col_privs->record[0]) &&
!key_cmp_if_same(col_privs,key,0,key_len));
+ col_privs->file->ha_index_end();
}
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 07c894dc8c1..b86bfb07386 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -549,21 +549,23 @@ bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
return FALSE;
}
+
/*
Update some cache variables when character set changes
*/
void THD::update_charset()
{
- charset_is_system_charset= my_charset_same(charset(),system_charset_info);
- charset_is_collation_connection= my_charset_same(charset(),
- variables.
- collation_connection);
+ uint32 not_used;
+ charset_is_system_charset= !String::needs_conversion(0,charset(),
+ system_charset_info,
+ &not_used);
+ charset_is_collation_connection=
+ !String::needs_conversion(0,charset(),variables.collation_connection,
+ &not_used);
}
-
-
/* routings to adding tables to list of changed in transaction tables */
inline static void list_include(CHANGED_TABLE_LIST** prev,
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 947dd559559..9889d4a2b4a 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -40,6 +40,197 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
const char *db, const char *path,
uint level);
+/* Database options hash */
+static HASH dboptions;
+static my_bool dboptions_init= 0;
+static rw_lock_t LOCK_dboptions;
+
+/* Structure for database options */
+typedef struct my_dbopt_st
+{
+ char *name; /* Database name */
+ uint name_length; /* Database length name */
+ CHARSET_INFO *charset; /* Database default character set */
+} my_dbopt_t;
+
+
+/*
+ Function we use in the creation of our hash to get key.
+*/
+static byte* dboptions_get_key(my_dbopt_t *opt, uint *length,
+ my_bool not_used __attribute__((unused)))
+{
+ *length= opt->name_length;
+ return (byte*) opt->name;
+}
+
+
+/*
+ Function to free dboptions hash element
+*/
+
+static void free_dbopt(void *dbopt)
+{
+ my_free((gptr) dbopt, MYF(0));
+}
+
+
+/*
+ Initialize database option hash
+
+ SYNOPSIS
+ my_dbopt_init()
+
+ NOTES
+ Must be called before any other database function is called.
+
+ RETURN
+ 0 ok
+ 1 Fatal error
+*/
+
+bool my_dbopt_init(void)
+{
+ bool error= 0;
+ (void) my_rwlock_init(&LOCK_dboptions, NULL);
+ if (!dboptions_init)
+ {
+ dboptions_init= 1;
+ error= hash_init(&dboptions, lower_case_table_names ?
+ &my_charset_bin : system_charset_info,
+ 32, 0, 0, (hash_get_key) dboptions_get_key,
+ free_dbopt,0);
+ }
+ return error;
+}
+
+
+/*
+ Free database option hash.
+*/
+
+void my_dbopt_free(void)
+{
+ if (dboptions_init)
+ {
+ dboptions_init= 0;
+ hash_free(&dboptions);
+ (void) rwlock_destroy(&LOCK_dboptions);
+ }
+}
+
+
+void my_dbopt_cleanup(void)
+{
+ rw_wrlock(&LOCK_dboptions);
+ hash_free(&dboptions);
+ hash_init(&dboptions, lower_case_table_names ?
+ &my_charset_bin : system_charset_info,
+ 32, 0, 0, (hash_get_key) dboptions_get_key,
+ free_dbopt,0);
+ rw_unlock(&LOCK_dboptions);
+}
+
+
+/*
+ Find database options in the hash.
+
+ DESCRIPTION
+ Search a database options in the hash, usings its path.
+ Fills "create" on success.
+
+ RETURN VALUES
+ 0 on success.
+ 1 on error.
+*/
+
+static my_bool get_dbopt(const char *dbname, HA_CREATE_INFO *create)
+{
+ my_dbopt_t *opt;
+ uint length;
+ my_bool error= 1;
+
+ length= (uint) strlen(dbname);
+
+ rw_rdlock(&LOCK_dboptions);
+ if ((opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length)))
+ {
+ create->default_table_charset= opt->charset;
+ error= 0;
+ }
+ rw_unlock(&LOCK_dboptions);
+ return error;
+}
+
+
+/*
+ Writes database options into the hash.
+
+ DESCRIPTION
+ Inserts database options into the hash, or updates
+ options if they are already in the hash.
+
+ RETURN VALUES
+ 0 on success.
+ 1 on error.
+*/
+
+static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create)
+{
+ my_dbopt_t *opt;
+ uint length;
+ my_bool error= 0;
+ DBUG_ENTER("put_dbopt");
+
+ length= (uint) strlen(dbname);
+
+ rw_wrlock(&LOCK_dboptions);
+ if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length)))
+ {
+ /* Options are not in the hash, insert them */
+ char *tmp_name;
+ if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
+ &opt, (uint) sizeof(*opt), &tmp_name, length+1,
+ NullS))
+ {
+ error= 1;
+ goto end;
+ }
+
+ opt->name= tmp_name;
+ strmov(opt->name, dbname);
+ opt->name_length= length;
+
+ if ((error= my_hash_insert(&dboptions, (byte*) opt)))
+ {
+ my_free((gptr) opt, MYF(0));
+ goto end;
+ }
+ }
+
+ /* Update / write options in hash */
+ opt->charset= create->default_table_charset;
+
+end:
+ rw_unlock(&LOCK_dboptions);
+ DBUG_RETURN(error);
+}
+
+
+/*
+ Deletes database options from the hash.
+*/
+
+void del_dbopt(const char *path)
+{
+ my_dbopt_t *opt;
+ rw_wrlock(&LOCK_dboptions);
+ if ((opt= (my_dbopt_t *)hash_search(&dboptions, path, strlen(path))))
+ hash_delete(&dboptions, (byte*) opt);
+ rw_unlock(&LOCK_dboptions);
+}
+
+
/*
Create database options file:
@@ -57,15 +248,20 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
char buf[256]; // Should be enough for one option
bool error=1;
+ if (!create->default_table_charset)
+ create->default_table_charset= thd->variables.collation_server;
+
+ if (put_dbopt(path, create))
+ return 1;
+
if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
ulong length;
- CHARSET_INFO *cs= ((create && create->default_table_charset) ?
- create->default_table_charset :
- thd->variables.collation_server);
- length= my_sprintf(buf,(buf,
- "default-character-set=%s\ndefault-collation=%s\n",
- cs->csname,cs->name));
+ length= (ulong) (strxnmov(buf, sizeof(buf), "default-character-set=",
+ create->default_table_charset->csname,
+ "\ndefault-collation=",
+ create->default_table_charset->name,
+ "\n", NullS) - buf);
/* Error is written by my_write */
if (!my_write(file,(byte*) buf, length, MYF(MY_NABP+MY_WME)))
@@ -102,6 +298,12 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
bzero((char*) create,sizeof(*create));
create->default_table_charset= thd->variables.collation_server;
+
+ /* Check if options for this database are already in the hash */
+ if (!get_dbopt(path, create))
+ DBUG_RETURN(0);
+
+ /* Otherwise, load options from the .opt file */
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
@@ -138,9 +340,16 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
}
}
}
- error=0;
end_io_cache(&cache);
my_close(file,MYF(0));
+ /*
+ Put the loaded value into the hash.
+ Note that another thread could've added the same
+ entry to the hash after we called get_dbopt(),
+ but it's not an error, as put_dbopt() takes this
+ possibility into account.
+ */
+ error= put_dbopt(path, create);
}
DBUG_RETURN(error);
}
@@ -168,10 +377,11 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
bool silent)
{
char path[FN_REFLEN+16];
- long result=1;
- int error = 0;
+ long result= 1;
+ int error= 0;
MY_STAT stat_info;
- uint create_options = create_info ? create_info->options : 0;
+ uint create_options= create_info ? create_info->options : 0;
+ uint path_len;
DBUG_ENTER("mysql_create_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
@@ -185,17 +395,18 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
/* Check directory */
strxmov(path, mysql_data_home, "/", db, NullS);
- unpack_dirname(path,path); // Convert if not unix
+ path_len= unpack_dirname(path,path); // Convert if not unix
+ path[path_len-1]= 0; // Remove last '/' from path
if (my_stat(path,&stat_info,MYF(0)))
{
if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS))
{
my_error(ER_DB_CREATE_EXISTS,MYF(0),db);
- error = -1;
+ error= -1;
goto exit;
}
- result = 0;
+ result= 0;
}
else
{
@@ -204,23 +415,23 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
my_error(EE_STAT, MYF(0),path,my_errno);
goto exit;
}
- strend(path)[-1]=0; // Remove last '/' from path
if (my_mkdir(path,0777,MYF(0)) < 0)
{
my_error(ER_CANT_CREATE_DB,MYF(0),db,my_errno);
- error = -1;
+ error= -1;
goto exit;
}
}
- unpack_dirname(path, path);
- strcat(path,MY_DB_OPT_FILE);
+ path[path_len-1]= FN_LIBCHAR;
+ strmake(path+path_len, MY_DB_OPT_FILE, sizeof(path)-path_len-1);
if (write_db_opt(thd, path, create_info))
{
/*
Could not create options file.
Restore things to beginning.
*/
+ path[path_len]= 0;
if (rmdir(path) >= 0)
{
error= -1;
@@ -271,7 +482,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
{
char path[FN_REFLEN+16];
long result=1;
- int error = 0;
+ int error= 0;
DBUG_ENTER("mysql_alter_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
@@ -281,7 +492,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
goto exit2;
/* Check directory */
- (void)sprintf(path,"%s/%s/%s", mysql_data_home, db, MY_DB_OPT_FILE);
+ strxmov(path, mysql_data_home, "/", db, "/", MY_DB_OPT_FILE, NullS);
fn_format(path, path, "", "", MYF(MY_UNPACK_FILENAME));
if ((error=write_db_opt(thd, path, create_info)))
goto exit;
@@ -334,9 +545,11 @@ exit2:
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{
long deleted=0;
- int error = 0;
+ int error= 0;
char path[FN_REFLEN+16], tmp_db[NAME_LEN+1];
MY_DIR *dirp;
+ uint length;
+ my_dbopt_t *dbopt;
DBUG_ENTER("mysql_rm_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
@@ -349,9 +562,13 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
}
(void) sprintf(path,"%s/%s",mysql_data_home,db);
- unpack_dirname(path,path); // Convert if not unix
+ length= unpack_dirname(path,path); // Convert if not unix
+ strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
+ del_dbopt(path); // Remove dboption hash entry
+ path[length]= '\0'; // Remove file name
+
/* See if the directory exists */
- if (!(dirp = my_dir(path,MYF(MY_DONT_SORT))))
+ if (!(dirp= my_dir(path,MYF(MY_DONT_SORT))))
{
if (!if_exists)
{
@@ -635,8 +852,10 @@ bool mysql_change_db(THD *thd, const char *name)
int length, db_length;
char *dbname=my_strdup((char*) name,MYF(MY_WME));
char path[FN_REFLEN];
- ulong db_access;
HA_CREATE_INFO create;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ ulong db_access;
+#endif
DBUG_ENTER("mysql_change_db");
if (!dbname || !(db_length= strlen(dbname)))
@@ -697,4 +916,3 @@ bool mysql_change_db(THD *thd, const char *name)
thd->variables.collation_database= thd->db_charset;
DBUG_RETURN(0);
}
-
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6870721a085..3eea8ae30d3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5351,6 +5351,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
if (lock_global_read_lock(thd))
return 1;
}
+ my_dbopt_cleanup();
result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables);
}
if (options & REFRESH_HOSTS)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5893b9110d7..974012093e3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3831,7 +3831,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
Set tmp to (previous record count) * (records / combination)
*/
if ((found_part & 1) &&
- (!(table->file->index_flags(key) & HA_ONLY_WHOLE_INDEX) ||
+ (!(table->file->index_flags(key,0,0) & HA_ONLY_WHOLE_INDEX) ||
found_part == PREV_BITS(uint,keyinfo->key_parts)))
{
max_key_part=max_part_bit(found_part);
@@ -8865,14 +8865,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
if (!select->quick->reverse_sorted())
{
- int quick_type= select->quick->get_type();
- if (!(table->file->index_flags(ref_key) & HA_READ_PREV) ||
+ /* here used_key_parts >0 */
+ if (!(table->file->index_flags(ref_key,used_key_parts-1, 1)
+ & HA_READ_PREV) ||
quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE ||
quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT ||
quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION)
DBUG_RETURN(0); // Use filesort
- // ORDER BY range_key DESC
+ /* ORDER BY range_key DESC */
QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC((QUICK_RANGE_SELECT*)(select->quick),
used_key_parts);
if (!tmp || tmp->error)
@@ -8892,8 +8893,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
Use a traversal function that starts by reading the last row
with key part (A) and then traverse the index backwards.
*/
- if (!(table->file->index_flags(ref_key) & HA_READ_PREV))
- DBUG_RETURN(0); // Use filesort
+ if (!(table->file->index_flags(ref_key,used_key_parts-1, 1)
+ & HA_READ_PREV))
+ DBUG_RETURN(0); // Use filesort
tab->read_first_record= join_read_last_key;
tab->read_record.read_record= join_read_prev_same;
/* fall through */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 3e99704e80c..62bee1209e1 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -37,9 +37,6 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
grant_names};
#endif
-static int mysql_find_files(THD *thd,List<char> *files, const char *db,
- const char *path, const char *wild, bool dir);
-
static int
store_create_info(THD *thd, TABLE *table, String *packet);
@@ -361,7 +358,7 @@ int mysqld_show_column_types(THD *thd)
}
-static int
+int
mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
const char *wild, bool dir)
{
@@ -701,8 +698,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
byte *pos;
uint flags=field->flags;
String type(tmp,sizeof(tmp), system_charset_info);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access;
-
+#endif
protocol->prepare_for_resend();
protocol->store(field->field_name, system_charset_info);
field->sql_type(type);
@@ -995,7 +993,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
str=(key_part->field ? key_part->field->field_name :
"?unknown field?");
protocol->store(str, system_charset_info);
- if (table->file->index_flags(i) & HA_READ_ORDER)
+ if (table->file->index_flags(i, j, 0) & HA_READ_ORDER)
protocol->store(((key_part->key_part_flag & HA_REVERSE_SORT) ?
"D" : "A"), 1, system_charset_info);
else
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 48bd9e572b0..21d41b84e4b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1154,6 +1154,23 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
#endif
+ /*
+ If the table character set was not given explicitely,
+ let's fetch the database default character set and
+ apply it to the table.
+ */
+ if (!create_info->default_table_charset)
+ {
+ HA_CREATE_INFO db_info;
+ uint length;
+ char path[FN_REFLEN];
+ strxmov(path, mysql_data_home, "/", db, NullS);
+ length= unpack_dirname(path,path); // Convert if not unix
+ strmov(path+length, MY_DB_OPT_FILE);
+ load_db_opt(thd, path, &db_info);
+ create_info->default_table_charset= db_info.default_table_charset;
+ }
+
if (mysql_prepare_table(thd, create_info, fields,
keys, tmp_table, db_options, file,
key_info_buffer, &key_count,
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index e0281c813f1..963607f2d0e 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -61,7 +61,10 @@ int mysql_update(THD *thd,
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed;
int error=0;
- uint used_index, want_privilege;
+ uint used_index;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ uint want_privilege;
+#endif
ulong query_id=thd->query_id, timestamp_query_id;
ha_rows updated, found;
key_map old_used_keys;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index cf17d38566d..de89983bc51 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1084,7 +1084,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
- lex->create_info.default_table_charset= thd->variables.collation_database;
+ lex->create_info.default_table_charset= NULL;
lex->name=0;
}
create2
@@ -2882,7 +2882,7 @@ alter:
lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
- lex->create_info.default_table_charset= thd->variables.collation_database;
+ lex->create_info.default_table_charset= NULL;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_info.reset();
lex->alter_info.is_simple= 1;
@@ -5704,7 +5704,9 @@ opt_db:
wild:
/* empty */
- | LIKE text_string { Lex->wild= $2; };
+ | LIKE TEXT_STRING_sys
+ { Lex->wild= new (&YYTHD->mem_root) String($2.str, $2.length,
+ system_charset_info); };
opt_full:
/* empty */ { Lex->verbose=0; }
@@ -6202,7 +6204,19 @@ IDENT_sys:
{
THD *thd= YYTHD;
if (thd->charset_is_system_charset)
+ {
+ CHARSET_INFO *cs= system_charset_info;
+ uint wlen= cs->cset->well_formed_len(cs, $1.str,
+ $1.str+$1.length,
+ $1.length);
+ if (wlen < $1.length)
+ {
+ net_printf(YYTHD, ER_INVALID_CHARACTER_STRING, cs->csname,
+ $1.str + wlen);
+ YYABORT;
+ }
$$= $1;
+ }
else
thd->convert_string(&$$, system_charset_info,
$1.str, $1.length, thd->charset());
diff --git a/sql/table.cc b/sql/table.cc
index 5024015c382..7d1c733b116 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -167,9 +167,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam->keys= keys= disk_buff[0];
outparam->key_parts= key_parts= disk_buff[1];
}
- outparam->keys_for_keyread.init(keys);
+ outparam->keys_for_keyread.init(0);
outparam->keys_in_use.init(keys);
- outparam->read_only_keys.init(0);
+ outparam->read_only_keys.init(keys);
outparam->quick_keys.init();
outparam->used_keys.init();
outparam->keys_in_use_for_query.init();
@@ -500,13 +500,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (outparam->key_info[key].flags & HA_FULLTEXT)
outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT;
- /* This has to be done after the above fulltext correction */
- if (!(outparam->file->index_flags(key) & HA_KEYREAD_ONLY))
- {
- outparam->read_only_keys.set_bit(key);
- outparam->keys_for_keyread.clear_bit(key);
- }
-
if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME))
{
/*
@@ -576,9 +569,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (field->key_length() == key_part->length &&
!(field->flags & BLOB_FLAG))
{
- if (outparam->file->index_flags(key, i) & HA_KEYREAD_ONLY)
+ if (outparam->file->index_flags(key, i, 0) & HA_KEYREAD_ONLY)
+ {
+ outparam->read_only_keys.clear_bit(key);
+ outparam->keys_for_keyread.set_bit(key);
field->part_of_key.set_bit(key);
- if (outparam->file->index_flags(key, i) & HA_READ_ORDER)
+ }
+ if (outparam->file->index_flags(key, i, 1) & HA_READ_ORDER)
field->part_of_sortkey.set_bit(key);
}
if (!(key_part->key_part_flag & HA_REVERSE_SORT) &&
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 5bb710946b1..1b49abd0fbb 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -6653,6 +6653,9 @@ static const char spanish2[]= /* Also good for Asturian and Galician */
"&N < \\u00F1 <<< \\u00D1"
"&R << rr <<< Rr <<< RR";
+static const char roman[]= /* i.e. Classical Latin */
+ "& I << j <<< J "
+ "& V << u <<< U ";
/*
Unicode Collation Algorithm:
@@ -8328,6 +8331,34 @@ CHARSET_INFO my_charset_ucs2_spanish2_uca_ci=
&my_collation_ucs2_uca_handler
};
+
+CHARSET_INFO my_charset_ucs2_roman_uca_ci=
+{
+ 143,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ "ucs2", /* cs name */
+ "ucs2_roman_ci", /* name */
+ "", /* comment */
+ roman, /* tailoring */
+ NULL, /* ctype */
+ NULL, /* to_lower */
+ NULL, /* to_upper */
+ NULL, /* sort_order */
+ NULL, /* contractions */
+ NULL, /* sort_order_big*/
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ NULL, /* state_map */
+ NULL, /* ident_map */
+ 8, /* strxfrm_multiply */
+ 2, /* mbminlen */
+ 2, /* mbmaxlen */
+ 9, /* min_sort_char */
+ 0xFFFF, /* max_sort_char */
+ &my_charset_ucs2_handler,
+ &my_collation_ucs2_uca_handler
+};
+
#endif
@@ -8779,4 +8810,31 @@ CHARSET_INFO my_charset_utf8_spanish2_uca_ci=
&my_charset_utf8_handler,
&my_collation_any_uca_handler
};
+
+CHARSET_INFO my_charset_utf8_roman_uca_ci=
+{
+ 207,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ "utf8", /* cs name */
+ "utf8_roman_ci", /* name */
+ "", /* comment */
+ roman, /* tailoring */
+ ctype_utf8, /* ctype */
+ NULL, /* to_lower */
+ NULL, /* to_upper */
+ NULL, /* sort_order */
+ NULL, /* contractions */
+ NULL, /* sort_order_big*/
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ NULL, /* state_map */
+ NULL, /* ident_map */
+ 8, /* strxfrm_multiply */
+ 1, /* mbminlen */
+ 2, /* mbmaxlen */
+ 9, /* min_sort_char */
+ 0xFFFF, /* max_sort_char */
+ &my_charset_utf8_handler,
+ &my_collation_any_uca_handler
+};
#endif
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 8dea06d4adf..48a9058480a 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -203,9 +203,11 @@ int vio_close(Vio * vio)
#endif
r=CloseHandle(vio->hPipe);
}
- else if (vio->type != VIO_CLOSED)
+ else
#endif /* __WIN__ */
+ if (vio->type != VIO_CLOSED)
{
+ DBUG_ASSERT(vio->sd >= 0);
if (shutdown(vio->sd,2))
r= -1;
if (closesocket(vio->sd))