From 4629ae29deb28fc41af0442bc0a72394a8e50bee Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Tue, 24 Aug 2004 22:45:32 +0500 Subject: [PATCH 01/52] Fix for bug #4815 (embedded server calculates wrong places for outfiles) In some places in mysqld behaviour depends on system working directory It works badly in libmysqld because user can set it in the way he needs. I think we should explicitly insert mysql_real_data_home value in paths in these places --- sql/sql_class.cc | 13 +++++++++++-- sql/sql_load.cc | 16 +++------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index aecb2ef6522..80b9d6e20bf 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -854,12 +854,21 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange, { File file; uint option= MY_UNPACK_FILENAME; + char buff[FN_REFLEN]; #ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS option|= MY_REPLACE_DIR; // Force use of db directory #endif - (void) fn_format(path, exchange->file_name, thd->db ? thd->db : "", "", - option); + + char *cnt= strmake(buff, mysql_real_data_home, FN_REFLEN); + *cnt= FN_LIBCHAR; + cnt++; + cnt= strmake(cnt, thd->db ? thd->db : "", FN_REFLEN - (cnt-buff)); + *cnt= FN_LIBCHAR; + cnt++; + *cnt= 0; + + (void) fn_format(path, exchange->file_name, buff, "", option); if (!access(path, F_OK)) { my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 8442d03c1d9..1f4905837f0 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -180,7 +180,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ex->file_name+=dirname_length(ex->file_name); #endif if (!dirname_length(ex->file_name) && - strlen(ex->file_name)+strlen(mysql_data_home)+strlen(tdb)+3 < + strlen(ex->file_name)+strlen(mysql_real_data_home)+strlen(tdb)+3 < FN_REFLEN) { (void) sprintf(name,"%s/%s/%s",mysql_data_home,tdb,ex->file_name); @@ -188,18 +188,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } else { -#ifdef EMBEDDED_LIBRARY - char *chk_name= ex->file_name; - while ((*chk_name == ' ') || (*chk_name == 't')) - chk_name++; - if (*chk_name == FN_CURLIB) - { - sprintf(name, "%s%s", mysql_data_home, ex->file_name); - unpack_filename(name, name); - } - else -#endif /*EMBEDDED_LIBRARY*/ - unpack_filename(name,ex->file_name); + my_load_path(name, ex->file_name, mysql_real_data_home); + unpack_filename(name, name); #if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__) MY_STAT stat_info; if (!my_stat(name,&stat_info,MYF(MY_WME))) From 2ed54c12e50270365cb53c7358ea47357d903b42 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Thu, 26 Aug 2004 19:57:32 +0200 Subject: [PATCH 02/52] - fixed brain fart in Bootrap - it never actually caught failures when pulling BK trees before. --- Build-tools/Bootstrap | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index c1063363bdf..8cad093bc5f 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -123,14 +123,16 @@ if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run)) if ($opt_pull) { &logger("Updating BK tree $REPO to latest ChangeSet first"); - $command= "cd $REPO; bk pull; cd .."; - &run_command($command, "Could not update $REPO!"); + chdir ($REPO) or &abort("Could not chdir to $REPO!"); + &run_command("bk pull", "Could not update $REPO!"); + chdir ($PWD) or &abort("Could not chdir to $PWD!"); unless ($opt_skip_manual) { &logger("Updating manual tree in $opt_docdir"); - $command= "cd $opt_docdir; bk pull; cd .."; - &run_command($command, "Could not update $opt_docdir!"); + chdir ($opt_docdir) or &abort("Could not chdir to $opt_docdir!"); + &run_command("bk pull", "Could not update $opt_docdir!"); + chdir ($PWD) or &abort("Could not chdir to $PWD!"); } } From caf1e73be7bf3d968dcf3fa00c0f69fbfab119f0 Mon Sep 17 00:00:00 2001 From: "rburnett@build.mysql.com" <> Date: Fri, 27 Aug 2004 01:08:57 +0200 Subject: [PATCH 03/52] Adding a file that was missed during the first push This file was part of the patch for Bug #4466 Nothing in .err when mysql service ends because of malformed my.ini options message.mc: new file --- VC++Files/sql/message.mc | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 VC++Files/sql/message.mc diff --git a/VC++Files/sql/message.mc b/VC++Files/sql/message.mc new file mode 100644 index 00000000000..a1a7c8cff7e --- /dev/null +++ b/VC++Files/sql/message.mc @@ -0,0 +1,8 @@ +MessageId = 100 +Severity = Error +Facility = Application +SymbolicName = MSG_DEFAULT +Language = English +%1For more information, see Help and Support Center at http://www.mysql.com. + + From 43b792d5cfa7cee89616197d72206d8dd42ce97d Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 27 Aug 2004 10:54:57 +0500 Subject: [PATCH 04/52] win1251.conf: Wrong UPPER/LOWER translation for Cyrillic letter tse was fixed. bug#5110 --- BitKeeper/etc/logging_ok | 1 + sql/share/charsets/win1251.conf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 8183cf5040d..698f7655b6e 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -16,6 +16,7 @@ arjen@george.bitbike.com bar@bar.intranet.mysql.r18.ru bar@bar.mysql.r18.ru bar@bar.udmsearch.izhnet.ru +bar@mysql.com bell@laptop.sanja.is.com.ua bell@sanja.is.com.ua bk@admin.bk diff --git a/sql/share/charsets/win1251.conf b/sql/share/charsets/win1251.conf index a5ccc3190ad..e05568323b4 100644 --- a/sql/share/charsets/win1251.conf +++ b/sql/share/charsets/win1251.conf @@ -41,7 +41,7 @@ A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F5 F7 F8 F9 FA FB FC FD FE FF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF @@ -59,7 +59,7 @@ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D5 D7 D8 D9 DA DB DC DD DE DF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF From 5258ea12cf1ccc723e6bb304a1fbe0e3abf1d204 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 27 Aug 2004 12:09:28 +0500 Subject: [PATCH 05/52] table.cc: Bug #4558 Escape handling error for ENUM values in SJIS encoding --- sql/table.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sql/table.cc b/sql/table.cc index 7e6338a3f3f..898ed4bca3d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -993,8 +993,26 @@ ulong next_io_size(register ulong pos) void append_unescaped(String *res,const char *pos) { - for (; *pos ; pos++) +#ifdef USE_MB + const char *end= pos + strlen(pos); +#endif + + for (; *pos ; ) { +#ifdef USE_MB + /* + Note, there is no needs to propagate this code into 4.1. + */ + uint mblen; + if (use_mb(default_charset_info) && + (mblen= my_ismbchar(default_charset_info, pos, end))) + { + res->append(pos, mblen); + pos+= mblen; + continue; + } +#endif + switch (*pos) { case 0: /* Must be escaped for 'mysql' */ res->append('\\'); @@ -1020,6 +1038,7 @@ void append_unescaped(String *res,const char *pos) res->append(*pos); break; } + pos++; } } From 3acccb988a7fba5f075acf7615bc0ec7f8548366 Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Fri, 27 Aug 2004 16:43:01 +0500 Subject: [PATCH 06/52] A fix (Bug #5232: CREATE TABLE ... SELECT can deadlock itself). --- mysql-test/r/merge.result | 9 +++++++++ mysql-test/t/merge.test | 14 ++++++++++++++ sql/sql_parse.cc | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 7b2b9a47b0f..3585b8b0018 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -610,3 +610,12 @@ x y 1 3 1 2 drop table t1,t2,t3; +create table t1 (a int); +create table t2 (a int); +insert into t1 values (0); +insert into t2 values (1); +create table t3 engine=merge union=(t1, t2) select * from t1; +INSERT TABLE 't1' isn't allowed in FROM table list +create table t3 engine=merge union=(t1, t2) select * from t2; +INSERT TABLE 't2' isn't allowed in FROM table list +drop table t1, t2; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 76382a9cd99..57770dc0a0b 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -250,3 +250,17 @@ select * from t3 where x = 1 and y < 5 order by y; # Bug is that followng query returns empty set while it must be same as above select * from t3 where x = 1 and y < 5 order by y desc; drop table t1,t2,t3; + +# +# Bug#5232: CREATE TABLE ... SELECT +# + +create table t1 (a int); +create table t2 (a int); +insert into t1 values (0); +insert into t2 values (1); +--error 1093 +create table t3 engine=merge union=(t1, t2) select * from t1; +--error 1093 +create table t3 engine=merge union=(t1, t2) select * from t2; +drop table t1, t2; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 14fc748c288..e95c52f1e48 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1655,6 +1655,19 @@ mysql_execute_command(void) net_printf(&thd->net,ER_INSERT_TABLE_USED,tables->real_name); DBUG_VOID_RETURN; } + if (lex->create_info.used_fields & HA_CREATE_USED_UNION) + { + TABLE_LIST *tab; + for (tab= tables; tab; tab= tab->next) + { + if (check_dup(tables->db, tab->real_name, + (TABLE_LIST*)lex->create_info.merge_list.first)) + { + net_printf(&thd->net, ER_INSERT_TABLE_USED, tab->real_name); + DBUG_VOID_RETURN; + } + } + } if (tables->next) { TABLE_LIST *table; From 4d1dedd70da4f5d325229d24d38bd81732ccbc99 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 27 Aug 2004 21:17:29 +0500 Subject: [PATCH 07/52] Compile all charset conversion tables if --with-extra-charsets=all or --with-extra-charsets=complex is given. --- acconfig.h | 3 +++ configure.in | 2 ++ sql/convert.cc | 3 +++ 3 files changed, 8 insertions(+) diff --git a/acconfig.h b/acconfig.h index 825842d256a..71dea4825f6 100644 --- a/acconfig.h +++ b/acconfig.h @@ -281,6 +281,9 @@ /* READLINE: */ #undef VOID_SIGHANDLER +/* Define this if you want extra character set conversion table*/ +#undef DEFINE_ALL_CHARACTER_SETS + /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: diff --git a/configure.in b/configure.in index 2adf2208332..7853b615ae0 100644 --- a/configure.in +++ b/configure.in @@ -2262,9 +2262,11 @@ elif test "$extra_charsets" = complex; then CHARSETS=`/bin/ls -1 $srcdir/strings/ctype-*.c | \ sed -e 's;^.*/ctype-;;' -e 's;.c$;;'` CHARSETS=`echo $CHARSETS` # get rid of line breaks + AC_DEFINE([DEFINE_ALL_CHARACTER_SETS]) else if test "$extra_charsets" = all; then CHARSETS="$CHARSETS_AVAILABLE $CHARSETS_DEPRECATED" + AC_DEFINE([DEFINE_ALL_CHARACTER_SETS]) else CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'` fi diff --git a/sql/convert.cc b/sql/convert.cc index e4ae13d1e07..f84c80a6121 100644 --- a/sql/convert.cc +++ b/sql/convert.cc @@ -20,6 +20,9 @@ ** Some of the tables are hidden behind IFDEF to reduce some space. ** One can enable them by removing the // characters from the next comment ** One must also give a name to each mapping that one wants to use... +** +** All tables are activated if --with-extra-charsets=all or +** --with-extra-charsets=complex was given to configure. */ /* #define DEFINE_ALL_CHARACTER_SETS */ From f574cd4e8f7f9794385cf5b9f6ddfc8530245005 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Sat, 28 Aug 2004 00:49:54 +0300 Subject: [PATCH 08/52] Code style fixes. Initialize LOG_error_log before get_options to not use an uninitalized mutex in case of an error from handle_options() --- mysql-test/r/lowercase_table.result | 21 +++- mysql-test/t/lowercase_table.test | 17 ++- mysys/my_getopt.c | 87 +++++++------- sql/log.cc | 171 +++++++++++++++------------- sql/mysqld.cc | 20 ++-- sql/sql_base.cc | 13 ++- sql/table.cc | 5 +- 7 files changed, 187 insertions(+), 147 deletions(-) diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result index 5acab254511..43d24b1ab17 100644 --- a/mysql-test/r/lowercase_table.result +++ b/mysql-test/r/lowercase_table.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3,t4,T1; +drop database if exists mysqltest; create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); @@ -39,12 +40,22 @@ Unknown table 'T1' in field list select count(bags.a) from t1 as Bags; Unknown table 'bags' in field list drop table t1; -create database foo; -use foo; +create database mysqltest; +use MYSQLTEST; create table t1 (a int); -select FOO.t1.* from FOO.t1; +select T1.a from MYSQLTEST.T1; +a +select t1.a from MYSQLTEST.T1; +Unknown table 't1' in field list +select mysqltest.t1.* from MYSQLTEST.t1; +a +select MYSQLTEST.t1.* from MYSQLTEST.t1; +a +select MYSQLTEST.T1.* from MYSQLTEST.T1; +a +select MYSQLTEST.T1.* from T1; a alter table t1 rename to T1; -select FOO.t1.* from FOO.t1; +select MYSQLTEST.t1.* from MYSQLTEST.t1; a -drop database FOO; +drop database mysqltest; diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index d52c60baea7..1b431a9d920 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -3,6 +3,7 @@ # drop table if exists t1,t2,t3,t4,T1; +drop database if exists mysqltest; create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); @@ -34,10 +35,16 @@ drop table t1; # # Test all caps database name # -create database foo; -use foo; +create database mysqltest; +use MYSQLTEST; create table t1 (a int); -select FOO.t1.* from FOO.t1; +select T1.a from MYSQLTEST.T1; +--error 1109 +select t1.a from MYSQLTEST.T1; +select mysqltest.t1.* from MYSQLTEST.t1; +select MYSQLTEST.t1.* from MYSQLTEST.t1; +select MYSQLTEST.T1.* from MYSQLTEST.T1; +select MYSQLTEST.T1.* from T1; alter table t1 rename to T1; -select FOO.t1.* from FOO.t1; -drop database FOO; +select MYSQLTEST.t1.* from MYSQLTEST.t1; +drop database mysqltest; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index c471a30eb35..f9df4afb55d 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -56,12 +56,12 @@ char *disabled_my_option= (char*) "0"; my_bool my_getopt_print_errors= 1; -void default_reporter( enum loglevel level, const char *format, ... ) +void default_reporter(enum loglevel level, const char *format, ...) { va_list args; - va_start( args, format ); - vfprintf( stderr, format, args ); - va_end( args ); + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); } /* @@ -75,8 +75,9 @@ void default_reporter( enum loglevel level, const char *format, ... ) */ int handle_options(int *argc, char ***argv, - const struct my_option *longopts, my_get_one_option get_one_option, - my_error_reporter reporter ) + const struct my_option *longopts, + my_get_one_option get_one_option, + my_error_reporter reporter) { uint opt_found, argvpos= 0, length, i; my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used, @@ -90,7 +91,8 @@ int handle_options(int *argc, char ***argv, (*argv)++; /* --- || ---- */ init_variables(longopts); - if (! reporter) reporter = &default_reporter; + if (! reporter) + reporter= &default_reporter; for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) { @@ -116,7 +118,8 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: Option '-O' requires an argument\n", progname ); + reporter(ERROR_LEVEL, + "%s: Option '-O' requires an argument\n", progname); return EXIT_ARGUMENT_REQUIRED; } cur_arg= *pos; @@ -132,7 +135,9 @@ int handle_options(int *argc, char ***argv, if (!*cur_arg) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n", progname ); + reporter(ERROR_LEVEL, + "%s: Option '--set-variable' requires an argument\n", + progname); return EXIT_ARGUMENT_REQUIRED; } } @@ -144,7 +149,9 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n", progname ); + reporter(ERROR_LEVEL, + "%s: Option '--set-variable' requires an argument\n", + progname); return EXIT_ARGUMENT_REQUIRED; } cur_arg= *pos; @@ -203,10 +210,10 @@ int handle_options(int *argc, char ***argv, if (opt_found > 1) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, - "%s: ambiguous option '--%s-%s' (--%s-%s)\n", - progname, special_opt_prefix[i], cur_arg, - special_opt_prefix[i], prev_found); + reporter(ERROR_LEVEL, + "%s: ambiguous option '--%s-%s' (--%s-%s)\n", + progname, special_opt_prefix[i], cur_arg, + special_opt_prefix[i], prev_found); return EXIT_AMBIGUOUS_OPTION; } switch (i) { @@ -238,16 +245,16 @@ int handle_options(int *argc, char ***argv, if (must_be_var) { if (my_getopt_print_errors) - reporter( option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, - "%s: unknown variable '%s'\n", progname, cur_arg ); + reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown variable '%s'\n", progname, cur_arg); if (!option_is_loose) return EXIT_UNKNOWN_VARIABLE; } else { if (my_getopt_print_errors) - reporter( option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, - "%s: unknown option '--%s'\n", progname, cur_arg ); + reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown option '--%s'\n", progname, cur_arg); if (!option_is_loose) return EXIT_UNKNOWN_OPTION; } @@ -263,23 +270,23 @@ int handle_options(int *argc, char ***argv, if (must_be_var) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n", - progname, cur_arg); + reporter(ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n", + progname, cur_arg); return EXIT_VAR_PREFIX_NOT_UNIQUE; } else { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n", - progname, cur_arg, prev_found, optp->name); + reporter(ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n", + progname, cur_arg, prev_found, optp->name); return EXIT_AMBIGUOUS_OPTION; } } if (must_be_var && optp->var_type == GET_NO_ARG) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: option '%s' cannot take an argument\n", - progname, optp->name); + reporter(ERROR_LEVEL, "%s: option '%s' cannot take an argument\n", + progname, optp->name); return EXIT_NO_ARGUMENT_ALLOWED; } if (optp->arg_type == NO_ARG) @@ -287,8 +294,9 @@ int handle_options(int *argc, char ***argv, if (optend && optp->var_type != GET_BOOL) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: option '--%s' cannot take an argument\n", - progname, optp->name); + reporter(ERROR_LEVEL, + "%s: option '--%s' cannot take an argument\n", + progname, optp->name); return EXIT_NO_ARGUMENT_ALLOWED; } if (optp->var_type == GET_BOOL) @@ -325,8 +333,9 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, "%s: option '--%s' requires an argument\n", - progname, optp->name); + reporter(ERROR_LEVEL, + "%s: option '--%s' requires an argument\n", + progname, optp->name); return EXIT_ARGUMENT_REQUIRED; } argument= *pos; @@ -375,9 +384,9 @@ int handle_options(int *argc, char ***argv, if (!pos[1]) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, - "%s: option '-%c' requires an argument\n", - progname, optp->id); + reporter(ERROR_LEVEL, + "%s: option '-%c' requires an argument\n", + progname, optp->id); return EXIT_ARGUMENT_REQUIRED; } argument= *++pos; @@ -387,9 +396,9 @@ int handle_options(int *argc, char ***argv, } if ((error= setval(optp, argument, set_maximum_value))) { - reporter( ERROR_LEVEL, - "%s: Error while setting value '%s' to '%s'\n", - progname, argument, optp->name); + reporter(ERROR_LEVEL, + "%s: Error while setting value '%s' to '%s'\n", + progname, argument, optp->name); return error; } get_one_option(optp->id, optp, argument); @@ -399,8 +408,8 @@ int handle_options(int *argc, char ***argv, if (!opt_found) { if (my_getopt_print_errors) - reporter( ERROR_LEVEL, - "%s: unknown option '-%c'\n", progname, *optend); + reporter(ERROR_LEVEL, + "%s: unknown option '-%c'\n", progname, *optend); return EXIT_UNKNOWN_OPTION; } } @@ -409,9 +418,9 @@ int handle_options(int *argc, char ***argv, } if ((error= setval(optp, argument, set_maximum_value))) { - reporter( ERROR_LEVEL, - "%s: Error while setting value '%s' to '%s'\n", - progname, argument, optp->name); + reporter(ERROR_LEVEL, + "%s: Error while setting value '%s' to '%s'\n", + progname, argument, optp->name); return error; } get_one_option(optp->id, optp, argument); diff --git a/sql/log.cc b/sql/log.cc index db7b80eb4f7..e9dd2e4a69b 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -43,37 +43,41 @@ static bool test_if_number(const char *str, #ifdef __NT__ static int eventSource = 0; -void setupWindowsEventSource() + +void setup_windows_event_source() { - if (eventSource) return; - - eventSource = 1; - HKEY hRegKey = NULL; - DWORD dwError = 0; - TCHAR szPath[ MAX_PATH ]; + HKEY hRegKey= NULL; + DWORD dwError= 0; + TCHAR szPath[MAX_PATH]; + DWORD dwTypes; - // Create the event source registry key - dwError = RegCreateKey( HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL", - &hRegKey ); + if (eventSource) // Ensure that we are only called once + return; + eventSource= 1; - // Name of the PE module that contains the message resource - GetModuleFileName( NULL, szPath, MAX_PATH ); + // Create the event source registry key + dwError= RegCreateKey(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL", + &hRegKey); - // Register EventMessageFile - dwError = RegSetValueEx( hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ, - (PBYTE) szPath, strlen(szPath)+1 ); + /* Name of the PE module that contains the message resource */ + GetModuleFileName(NULL, szPath, MAX_PATH); + + / Register EventMessageFile */ + dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ, + (PBYTE) szPath, strlen(szPath)+1); - // Register supported event types - DWORD dwTypes = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; - dwError = RegSetValueEx( hRegKey, "TypesSupported", 0, REG_DWORD, - (LPBYTE) &dwTypes, sizeof dwTypes ); + /* Register supported event types */ + dwTypes= (EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | + EVENTLOG_INFORMATION_TYPE); + dwError= RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD, + (LPBYTE) &dwTypes, sizeof dwTypes); - RegCloseKey( hRegKey ); + RegCloseKey(hRegKey); } -#endif +#endif /* __NT__ */ /**************************************************************************** @@ -1732,33 +1736,33 @@ static bool test_if_number(register const char *str, } /* test_if_number */ -void print_buffer_to_file( enum loglevel level, const char *buffer ) +void print_buffer_to_file(enum loglevel level, const char *buffer) { time_t skr; struct tm tm_tmp; struct tm *start; - - DBUG_ENTER("print_buffer_to_log"); + DBUG_ENTER("print_buffer_to_file"); + DBUG_PRINT("enter",("buffer: %s", buffer)); VOID(pthread_mutex_lock(&LOCK_error_log)); skr=time(NULL); localtime_r(&skr, &tm_tmp); start=&tm_tmp; - fprintf( stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n", + fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n", start->tm_year % 100, start->tm_mon+1, start->tm_mday, start->tm_hour, start->tm_min, start->tm_sec, - level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "WARNING" : "INFORMATION", - buffer ); + (level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? + "WARNING" : "INFORMATION"), + buffer); fflush(stderr); VOID(pthread_mutex_unlock(&LOCK_error_log)); - DBUG_VOID_RETURN; } @@ -1772,6 +1776,7 @@ void sql_perror(const char *message) #endif } + bool flush_error_log() { bool result=0; @@ -1820,122 +1825,124 @@ bool flush_error_log() #ifdef __NT__ -void print_buffer_to_nt_eventlog( enum loglevel level, char *buff, int buffLen ) +void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, + uint length, int buffLen) { HANDLE event; char *buffptr; LPCSTR *buffmsgptr; + DBUG_ENTER("print_buffer_to_nt_eventlog"); - DBUG_ENTER( "print_buffer_to_nt_eventlog" ); - - buffptr = buff; - if (strlen(buff) > (uint)(buffLen-4)) + buffptr= buff; + if (length > (uint)(buffLen-4)) { - char *newBuff = new char[ strlen(buff) + 4 ]; - strcpy( newBuff, buff ); - buffptr = newBuff; + char *newBuff= new char[length + 4]; + strcpy(newBuff, buff); + buffptr= newBuff; } - strcat( buffptr, "\r\n\r\n" ); - buffmsgptr = (LPCSTR*)&buffptr; + strmov(buffptr+length, "\r\n\r\n"); + buffmsgptr= (LPCSTR*) &buffptr; // Keep windows happy - setupWindowsEventSource(); - if (event = RegisterEventSource(NULL,"MySQL")) + setup_windows_event_source(); + if ((event= RegisterEventSource(NULL,"MySQL"))) { - switch (level){ + switch (level) { case ERROR_LEVEL: - ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL); + ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, + buffmsgptr, NULL); break; case WARNING_LEVEL: - ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL); + ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, + buffmsgptr, NULL); break; case INFORMATION_LEVEL: - ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL); + ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1, + 0, buffmsgptr, NULL); break; } DeregisterEventSource(event); } - // if we created a string buffer, then delete it - if ( buffptr != buff ) + /* if we created a string buffer, then delete it */ + if (buffptr != buff) delete[] buffptr; - DBUG_VOID_RETURN; } -#endif +#endif /* __NT__ */ + /* - Prints a printf style message to the error log and, under NT, to the Windows event log. + Prints a printf style message to the error log and, under NT, to the + Windows event log. SYNOPSIS vprint_msg_to_log() - event_type Type of event to write (Error, Warning, or Info) - format Printf style format of message - args va_list list of arguments for the message + event_type Type of event to write (Error, Warning, or Info) + format Printf style format of message + args va_list list of arguments for the message NOTE IMPLEMENTATION - This function prints the message into a buffer and then sends that buffer to other - functions to write that message to other logging sources. + This function prints the message into a buffer and then sends that buffer + to other functions to write that message to other logging sources. RETURN VALUES void */ + void vprint_msg_to_log(enum loglevel level, const char *format, va_list args) { char buff[1024]; - + uint length; DBUG_ENTER("vprint_msg_to_log"); - my_vsnprintf( buff, sizeof(buff)-5, format, args ); - - print_buffer_to_file( level, buff ); - -#ifndef DBUG_OFF - DBUG_PRINT("error",("%s",buff)); -#endif + length= my_vsnprintf(buff, sizeof(buff)-5, format, args); + print_buffer_to_file(level, buff); #ifdef __NT__ - print_buffer_to_nt_eventlog( level, buff, sizeof(buff) ); + print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff)); #endif DBUG_VOID_RETURN; } -void sql_print_error( const char *format, ... ) +void sql_print_error(const char *format, ...) { - DBUG_ENTER( "sql_print_error" ); - va_list args; - va_start( args, format ); - vprint_msg_to_log( ERROR_LEVEL, format, args ); - va_end( args ); + DBUG_ENTER("sql_print_error"); + + va_start(args, format); + vprint_msg_to_log(ERROR_LEVEL, format, args); + va_end(args); DBUG_VOID_RETURN; } -void sql_print_warning( const char *format, ... ) -{ - DBUG_ENTER( "sql_print_warning" ); +void sql_print_warning(const char *format, ...) +{ va_list args; - va_start( args, format ); - vprint_msg_to_log( WARNING_LEVEL, format, args ); - va_end( args ); + DBUG_ENTER("sql_print_warning"); + + va_start(args, format); + vprint_msg_to_log(WARNING_LEVEL, format, args); + va_end(args); DBUG_VOID_RETURN; } -void sql_print_information( const char *format, ... ) -{ - DBUG_ENTER( "sql_print_information" ); +void sql_print_information(const char *format, ...) +{ va_list args; - va_start( args, format ); - vprint_msg_to_log( INFORMATION_LEVEL, format, args ); - va_end( args ); + DBUG_ENTER("sql_print_information"); + + va_start(args, format); + vprint_msg_to_log(INFORMATION_LEVEL, format, args); + va_end(args); DBUG_VOID_RETURN; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8b10627b323..1068c5ec9a1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2247,6 +2247,10 @@ int main(int argc, char **argv) if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0]) opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */ + /* needed by get_options */ + + (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST); + set_options(); get_options(argc,argv); set_server_version(); @@ -2263,7 +2267,6 @@ int main(int argc, char **argv) (void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST); - (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW); @@ -5100,21 +5103,24 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } return 0; } - /* Initiates DEBUG - but no debugging here ! */ -void option_error_reporter( enum loglevel level, const char *format, ... ) + +void option_error_reporter(enum loglevel level, const char *format, ...) { va_list args; - va_start( args, format ); - vprint_msg_to_log( level, format, args ); - va_end( args ); + va_start(args, format); + vprint_msg_to_log(level, format, args); + va_end(args); } + /* Initiates DEBUG - but no debugging here ! */ + static void get_options(int argc,char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, option_error_reporter ))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, + option_error_reporter))) exit(ho_error); #if defined(HAVE_BROKEN_REALPATH) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 26ce394ec37..8fd7273fd78 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2066,13 +2066,16 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, uint found; DBUG_ENTER("insert_fields"); - if (db_name && lower_case_table_names) { - /* convert database to lower case for comparison */ - strmake( name_buff, db_name, sizeof(name_buff)-1 ); - casedn_str( name_buff ); - db_name = name_buff; + /* + convert database to lower case for comparison + We can't do this in Item_field as this would change the + 'name' of the item which may be used in the select list + */ + strmake(name_buff, db_name, sizeof(name_buff)-1); + casedn_str(name_buff); + db_name= name_buff; } diff --git a/sql/table.cc b/sql/table.cc index 898ed4bca3d..573fa11a4c4 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -999,10 +999,7 @@ void append_unescaped(String *res,const char *pos) for (; *pos ; ) { -#ifdef USE_MB - /* - Note, there is no needs to propagate this code into 4.1. - */ +#if defined(USE_MB) && MYSQL_VERSION_ID < 40100 uint mblen; if (use_mb(default_charset_info) && (mblen= my_ismbchar(default_charset_info, pos, end))) From 0f023b3b9b1acf4ba81dbf2178e6d435cfe10712 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Sat, 28 Aug 2004 09:31:15 +0200 Subject: [PATCH 09/52] - fixed typo so make dist does not fail --- support-files/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/Makefile.am b/support-files/Makefile.am index ddad52fbb2a..1f38b4c30c2 100644 --- a/support-files/Makefile.am +++ b/support-files/Makefile.am @@ -22,7 +22,7 @@ EXTRA_DIST = mysql.spec.sh \ my-medium.cnf.sh \ my-large.cnf.sh \ my-huge.cnf.sh \ - my-innodb-heavy-4G \ + my-innodb-heavy-4G.cnf.sh \ mysql-log-rotate.sh \ mysql.server.sh \ binary-configure.sh \ From 93101561fd3d49fde9b1408f1d2b9f036fcba658 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sun, 29 Aug 2004 14:13:51 +0200 Subject: [PATCH 10/52] Fix for BUG#4500 "set character set replicates incorrectly" We must not reset the charset in slave after each statement, otherwise the SET CHARACTER SET is cancelled immediately. Instead, we write a SET CHARACTER SET DEFAULT to the master's binlog when needed (like we already do for SET FOREIGN_KEY_CHECKS); such writing is not necessary in 4.1 (in 4.1 the bug does not exist, as the SET ONE_SHOT syntax is used). I have written a test and it works, but I'm not pushing the test as it requires building with all charsets. I have noticed differences between what is inserted in the master's table in 4.0 and 4.1, and alerted Bar. --- sql/log.cc | 22 +++++++++++++++++----- sql/log_event.cc | 2 -- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index db7b80eb4f7..9927bfe8d17 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1208,12 +1208,24 @@ bool MYSQL_LOG::write(Log_event* event_info) /* Write log events to reset the 'run environment' of the SQL command */ - if (thd && thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) + if (thd) { - Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0); - e.set_log_pos(this); - if (e.write(file)) - goto err; + if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) + { + Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0); + e.set_log_pos(this); + if (e.write(file)) + goto err; + } +#if MYSQL_VERSION_ID < 40100 + if (thd->variables.convert_set) + { + Query_log_event e(thd, "SET CHARACTER SET DEFAULT", 25, 0); + e.set_log_pos(this); + if (e.write(file)) + goto err; + } +#endif } /* diff --git a/sql/log_event.cc b/sql/log_event.cc index 3e1544adf14..5526795c9d1 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1932,8 +1932,6 @@ end: thd->query= 0; // just to be sure thd->query_length= 0; VOID(pthread_mutex_unlock(&LOCK_thread_count)); - // assume no convert for next query unless set explictly - thd->variables.convert_set = 0; close_thread_tables(thd); free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); return (thd->query_error ? thd->query_error : Log_event::exec_event(rli)); From 18366c930c54452b20245501d55babcca963ec5b Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Sun, 29 Aug 2004 23:14:46 +0300 Subject: [PATCH 11/52] NOT elimination moved in parsing (suggested by Monty) --- sql/item_cmpfunc.cc | 33 --------------------------------- sql/item_cmpfunc.h | 2 +- sql/sql_select.cc | 13 ------------- sql/sql_yacc.yy | 12 ++++++++++-- 4 files changed, 11 insertions(+), 49 deletions(-) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index bf7813eb9ba..de37e858bac 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2030,15 +2030,6 @@ void Item_cond::neg_arguments(THD *thd) { if (!(new_item= new Item_func_not(item))) return; // Fatal OEM error - /* - We can use 0 as tables list because Item_func_not do not use it - on fix_fields and its arguments are already fixed. - - We do not check results of fix_fields, because there are not way - to return error in this functions interface, thd->net.report_error - will be checked on upper level call. - */ - new_item->fix_fields(thd, 0, &new_item); } VOID(li.replace(new_item)); } @@ -2734,18 +2725,6 @@ Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */ Item *Item_bool_rowready_func2::neg_transformer(THD *thd) { Item *item= negated_item(); - if (item) - { - /* - We can use 0 as tables list because Item_func* family do not use it - on fix_fields and its arguments are already fixed. - - We do not check results of fix_fields, because there are not way - to return error in this functions interface, thd->net.report_error - will be checked on upper level call. - */ - item->fix_fields(thd, 0, &item); - } return item; } @@ -2754,9 +2733,6 @@ Item *Item_bool_rowready_func2::neg_transformer(THD *thd) Item *Item_func_isnull::neg_transformer(THD *thd) { Item *item= new Item_func_isnotnull(args[0]); - // see comment before fix_fields in Item_bool_rowready_func2::neg_transformer - if (item) - item->fix_fields(thd, 0, &item); return item; } @@ -2765,9 +2741,6 @@ Item *Item_func_isnull::neg_transformer(THD *thd) Item *Item_func_isnotnull::neg_transformer(THD *thd) { Item *item= new Item_func_isnull(args[0]); - // see comment before fix_fields in Item_bool_rowready_func2::neg_transformer - if (item) - item->fix_fields(thd, 0, &item); return item; } @@ -2777,9 +2750,6 @@ Item *Item_cond_and::neg_transformer(THD *thd) /* NOT(a AND b AND ...) -> */ { neg_arguments(thd); Item *item= new Item_cond_or(list); - // see comment before fix_fields in Item_bool_rowready_func2::neg_transformer - if (item) - item->fix_fields(thd, 0, &item); return item; } @@ -2789,9 +2759,6 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */ { neg_arguments(thd); Item *item= new Item_cond_and(list); - // see comment before fix_fields in Item_bool_rowready_func2::neg_transformer - if (item) - item->fix_fields(thd, 0, &item); return item; } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 4f2dcb6a412..c3551b35d63 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -274,7 +274,7 @@ public: enum Functype rev_functype() const { return EQUAL_FUNC; } cond_result eq_cmp_result() const { return COND_TRUE; } const char *func_name() const { return "<=>"; } - Item* neg_transformer(THD *thd) { return 0; } + Item *neg_transformer(THD *thd) { return 0; } }; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4ca8008c518..701d2597d3d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4401,19 +4401,6 @@ optimize_cond(THD *thd, COND *conds, Item::cond_result *cond_value) if (conds) { DBUG_EXECUTE("where", print_where(conds, "original");); - /* Eliminate NOT operators; in case of PS/SP do it once */ - if (thd->current_arena->is_first_stmt_execute()) - { - Item_arena *arena= thd->current_arena, backup; - thd->set_n_backup_item_arena(arena, &backup); - conds= eliminate_not_funcs(thd, conds); - select->prep_where= conds->copy_andor_structure(thd); - thd->restore_backup_item_arena(arena, &backup); - } - else - conds= eliminate_not_funcs(thd, conds); - DBUG_EXECUTE("where", print_where(conds, "after negation elimination");); - /* change field = field to field = const for each found field = const */ propagate_cond_constants((I_List *) 0, conds, conds); /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1c057e03a11..afb55463ad1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2755,8 +2755,16 @@ simple_expr: | '+' expr %prec NEG { $$= $2; } | '-' expr %prec NEG { $$= new Item_func_neg($2); } | '~' expr %prec NEG { $$= new Item_func_bit_neg($2); } - | NOT expr %prec NEG { $$= new Item_func_not($2); } - | '!' expr %prec NEG { $$= new Item_func_not($2); } + | NOT expr %prec NEG + { + if (($$= $2->neg_transformer(YYTHD)) == 0) + $$= new Item_func_not($2); + } + | '!' expr %prec NEG + { + if (($$= $2->neg_transformer(YYTHD)) == 0) + $$= new Item_func_not($2); + } | '(' expr ')' { $$= $2; } | '(' expr ',' expr_list ')' { From 547b46b7c9ba441498c77cb9e1863a36ab56cdef Mon Sep 17 00:00:00 2001 From: "rburnett@build.mysql.com" <> Date: Mon, 30 Aug 2004 00:50:39 +0200 Subject: [PATCH 12/52] log.cc: Fixed missing * in comment in setup_windows_event_source --- sql/log.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index aa45e2f77ee..55ef2e72960 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -63,7 +63,7 @@ void setup_windows_event_source() /* Name of the PE module that contains the message resource */ GetModuleFileName(NULL, szPath, MAX_PATH); - / Register EventMessageFile */ + /* Register EventMessageFile */ dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ, (PBYTE) szPath, strlen(szPath)+1); From 9632f7d9c808bc6ab0b27d8bfaa3b5b0981e7dfa Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 30 Aug 2004 09:20:52 +0200 Subject: [PATCH 13/52] - removed mysql-test/t/flush_block_commit-master.opt as it collided with the sleep value we use for the test suite run during the release builds --- mysql-test/t/flush_block_commit-master.opt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 mysql-test/t/flush_block_commit-master.opt diff --git a/mysql-test/t/flush_block_commit-master.opt b/mysql-test/t/flush_block_commit-master.opt deleted file mode 100644 index d1f6d58e9f7..00000000000 --- a/mysql-test/t/flush_block_commit-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_lock_wait_timeout=5 From 38d9ce96f943eadf18561fd565ea961b51c9e889 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Mon, 30 Aug 2004 10:13:13 +0200 Subject: [PATCH 14/52] typo fixed --- sql/field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index 71ec7545efc..394d53238c2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2341,7 +2341,7 @@ String *Field_double::val_str(String *val_buffer, else { #ifdef HAVE_FCONVERT - char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE], + char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; char *pos= buff; int decpt,sign,tmp_dec=dec; From 86fcffb3230cfe326da144db9e3009e5ab9c85ca Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Mon, 30 Aug 2004 17:41:41 +0200 Subject: [PATCH 15/52] If the system has 64 bit "long", then "long long" does not add new functionality. The existing code takes advantage of this when "typedef"ing 'longlong' in 'my_global.h'. This holds for Alpha CPUs. If the compiler then has prototypes for C99 functions 'strtoll()' and 'strtoull()' but no implementation, the existing code in 'strtoull.c' collides with that prototype. These collisions are avoided now. (backport from 4.1) --- include/m_string.h | 3 +++ strings/strto.c | 8 ++++++-- strings/strtol.c | 9 ++++++++- strings/strtoll.c | 13 +++++++++++-- strings/strtoul.c | 9 ++++++++- strings/strtoull.c | 13 ++++++++++++- 6 files changed, 48 insertions(+), 7 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index eb2758ec506..419e70d93bf 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -238,6 +238,9 @@ extern char *str2int(const char *src,int radix,long lower,long upper, #ifndef HAVE_STRTOULL #define HAVE_STRTOULL #endif +#ifndef HAVE_STRTOLL +#define HAVE_STRTOLL +#endif #else #ifdef HAVE_LONG_LONG extern char *longlong2str(longlong val,char *dst,int radix); diff --git a/strings/strto.c b/strings/strto.c index c98b19a7e67..9ad4502faaf 100644 --- a/strings/strto.c +++ b/strings/strto.c @@ -35,8 +35,12 @@ it can be compiled with the UNSIGNED and/or LONGLONG flag set */ -#include -#include "m_string.h" + +#if !defined(_global_h) || !defined(_m_string_h) +# error Calling file must include 'my_global.h' and 'm_string.h' + /* see 'strtoll.c' and 'strtoull.c' for the reasons */ +#endif + #include "m_ctype.h" #include "my_sys.h" /* defines errno */ #include diff --git a/strings/strtol.c b/strings/strtol.c index 10d7f8f9da6..ed4ca86c846 100644 --- a/strings/strtol.c +++ b/strings/strtol.c @@ -14,9 +14,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This defines strtol() if neaded */ +/* This implements strtol() if needed */ +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + */ #include +#include + #if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__) #include "strto.c" #endif diff --git a/strings/strtoll.c b/strings/strtoll.c index b0b4ef328fc..45352ffd360 100644 --- a/strings/strtoll.c +++ b/strings/strtoll.c @@ -14,11 +14,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This is defines strtoll() if neaded */ +/* This implements strtoll() if needed */ -#define strtoll glob_strtoll /* Fix for True64 */ +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + This solves a problem on Tru64 where the C99 compiler has a prototype + for 'strtoll()' but no implementation, see "6.1 New C99 library functions" + in file '/usr/share/doclib/cc.dtk/release_notes.txt'. + */ #include +#include + #if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG) #define USE_LONGLONG #include "strto.c" diff --git a/strings/strtoul.c b/strings/strtoul.c index 00e1f820942..77bc267d218 100644 --- a/strings/strtoul.c +++ b/strings/strtoul.c @@ -14,9 +14,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This is defines strtoul() if neaded */ +/* This implements strtoul() if needed */ +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + */ #include +#include + #if !defined(MSDOS) && !defined(HAVE_STRTOUL) #define USE_UNSIGNED #include "strto.c" diff --git a/strings/strtoull.c b/strings/strtoull.c index f4f3ce19bf7..0c2788bc188 100644 --- a/strings/strtoull.c +++ b/strings/strtoull.c @@ -14,9 +14,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This is defines strtoull() */ +/* This implements strtoull() if needed */ + +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + This solves a problem on Tru64 where the C99 compiler has a prototype + for 'strtoull()' but no implementation, see "6.1 New C99 library functions" + in file '/usr/share/doclib/cc.dtk/release_notes.txt'. + */ #include +#include + #if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG) #define USE_UNSIGNED #define USE_LONGLONG From 6adaff23a4b2170f59dda27cd5b897adb40c2542 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Tue, 31 Aug 2004 14:35:04 +0300 Subject: [PATCH 16/52] Review of new pushed code (Indentation fixes and simple optimizations) Use 'mysqltest' as test database instead of test_$1 or test1,test2 to not accidently delete an important database Safety fix for mailformed MERGE files --- Build-tools/mysql-copyright | 26 ++--- include/config-win.h | 2 - myisammrg/myrg_open.c | 28 ++--- mysql-test/r/create.result | 38 +++---- mysql-test/r/ndb_basic.result | 8 +- mysql-test/r/ndb_blob.result | 8 +- mysql-test/r/ndb_transaction.result | 8 +- mysql-test/r/ps_1general.result | 8 +- mysql-test/r/rpl_charset.result | 160 ++++++++++++++-------------- mysql-test/r/rpl_delete_all.result | 10 +- mysql-test/r/show_check.result | 55 +++++----- mysql-test/t/create.test | 34 +++--- mysql-test/t/ndb_basic.test | 10 +- mysql-test/t/ndb_blob.test | 10 +- mysql-test/t/ndb_transaction.test | 9 +- mysql-test/t/ps_1general.test | 8 +- mysql-test/t/rpl_charset.test | 36 +++---- mysql-test/t/rpl_delete_all.test | 6 +- mysql-test/t/show_check.test | 37 +++---- sql/field.h | 4 +- sql/lock.cc | 3 +- sql/sql_base.cc | 11 +- sql/sql_prepare.cc | 7 +- sql/sql_select.cc | 4 +- 24 files changed, 267 insertions(+), 263 deletions(-) diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index 77a90fbf4e4..0c091890e72 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -150,20 +150,20 @@ sub main #### sub fix_mysql_version { - chdir("$destdir"); - my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h'; - - open(MYSQL_VERSION,"<$header_file") or die "Unable to open include/mysql_version.h for read: $!\n"; - undef $/; - my $mysql_version= ; - close(MYSQL_VERSION); + chdir("$destdir"); + my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h'; - $mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/; - - open(MYSQL_VERSION,">$header_file") or die "Unable to open include/mysql_version.h for write: $!\n"; - print MYSQL_VERSION $mysql_version; - close(MYSQL_VERSION); - chdir("$cwd"); + open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n"; + undef $/; + my $mysql_version= ; + close(MYSQL_VERSION); + + $mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/; + + open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n"; + print MYSQL_VERSION $mysql_version; + close(MYSQL_VERSION); + chdir("$cwd"); } #### diff --git a/include/config-win.h b/include/config-win.h index 96a155633eb..0ba8dd2cf43 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -151,9 +151,7 @@ typedef uint rf_SetTimer; #endif /* ERROR is defined in wingdi.h */ -#ifdef ERROR #undef ERROR -#endif /* We need to close files to break connections on shutdown */ #ifndef SIGNAL_WITH_VIO_CLOSE diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 4c6ffb98ad5..a59ccb7d966 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { int save_errno,errpos=0; uint files=0,i,dir_length,length,key_parts; - ulonglong file_offset; + ulonglong file_offset=0; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO *m_info=0; File fd; IO_CACHE file; MI_INFO *isam=0; + uint found_merge_insert_method= 0; DBUG_ENTER("myrg_open"); + LINT_INIT(key_parts); + bzero((char*) &file,sizeof(file)); if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4), O_RDONLY | O_SHARE,MYF(0))) < 0) @@ -69,10 +72,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) continue; /* Skip empty lines */ if (buff[0] == '#') { - if( !strncmp(buff+1,"INSERT_METHOD=",14)) + if (!strncmp(buff+1,"INSERT_METHOD=",14)) { /* Lookup insert method */ int tmp=find_type(buff+15,&merge_insert_method,2); - m_info->merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); + found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); } continue; /* Skip comments */ } @@ -84,8 +87,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) VOID(cleanup_dirname(buff,name_buff)); } if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) - goto err; - if (!m_info) + goto err; + if (!m_info) /* First file */ { key_parts=isam->s->base.key_parts; if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) + @@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { m_info->open_tables=(MYRG_TABLE *) (m_info+1); m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); + m_info->tables= files; + files= 0; } - else - { - m_info->open_tables=0; - m_info->rec_per_key_part=0; - } - m_info->tables=files; m_info->reclength=isam->s->base.reclength; - file_offset=files=0; errpos=3; } m_info->open_tables[files].table= isam; @@ -122,14 +120,16 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) m_info->del+= isam->state->del; m_info->data_file_length+= isam->state->data_file_length; for (i=0; i < key_parts; i++) - m_info->rec_per_key_part[i]+=isam->s->state.rec_per_key_part[i] / m_info->tables; + m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] / + m_info->tables); } if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), - MYF(MY_WME|MY_ZEROFILL)))) + MYF(MY_WME | MY_ZEROFILL)))) goto err; /* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */ m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA); + m_info->merge_insert_method= found_merge_insert_method; if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) { diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 699485ff3f7..92c825f547d 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1,5 +1,5 @@ drop table if exists t1,t2,t3; -drop database if exists test_$1; +drop database if exists mysqltest; create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -58,18 +58,18 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10; drop table 1ea10; create table t1 (t1.index int); drop table t1; -drop database if exists test_$1; +drop database if exists mysqltest; Warnings: -Note 1008 Can't drop database 'test_$1'; database doesn't exist -create database test_$1; -create table test_$1.$test1 (a$1 int, $b int, c$ int); -insert into test_$1.$test1 values (1,2,3); -select a$1, $b, c$ from test_$1.$test1; +Note 1008 Can't drop database 'mysqltest'; database doesn't exist +create database mysqltest; +create table mysqltest.$test1 (a$1 int, $b int, c$ int); +insert into mysqltest.$test1 values (1,2,3); +select a$1, $b, c$ from mysqltest.$test1; a$1 $b c$ 1 2 3 -create table test_$1.test2$ (a int); -drop table test_$1.test2$; -drop database test_$1; +create table mysqltest.test2$ (a int); +drop table mysqltest.test2$; +drop database mysqltest; create table `` (a int); ERROR 42000: Incorrect table name '' drop table if exists ``; @@ -320,9 +320,9 @@ t3 CREATE TABLE `t3` ( select * from t3; id name drop table t2, t3; -create database test_$1; -create table test_$1.t3 like t1; -create temporary table t3 like test_$1.t3; +create database mysqltest; +create table mysqltest.t3 like t1; +create temporary table t3 like mysqltest.t3; show create table t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( @@ -339,7 +339,7 @@ t2 CREATE TABLE `t2` ( select * from t2; id name create table t3 like t1; -create table t3 like test_$1.t3; +create table t3 like mysqltest.t3; ERROR 42S01: Table 't3' already exists create table non_existing_database.t1 like t1; Got one of the listed errors @@ -351,7 +351,7 @@ create table t3 like `a/a`; ERROR 42000: Incorrect table name 'a/a' drop table t1, t2, t3; drop table t3; -drop database test_$1; +drop database mysqltest; SET SESSION storage_engine="heap"; SELECT @@storage_engine; @@storage_engine @@ -488,12 +488,12 @@ Note 1291 Column 'cset' has duplicated value 'b' in SET Note 1291 Column 'cset' has duplicated value 'B' in SET Note 1291 Column 'cset' has duplicated value 'd' in SET drop table t1, t2, t3; -create database test_$1; -use test_$1; +create database mysqltest; +use mysqltest; select database(); database() -test_$1 -drop database test_$1; +mysqltest +drop database mysqltest; select database(); database() NULL diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index e42485a1548..f5f5fe5ba18 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; -drop database if exists test2; +drop database if exists mysqltest; CREATE TABLE t1 ( pk1 INT NOT NULL PRIMARY KEY, attr1 INT NOT NULL, @@ -1362,8 +1362,8 @@ attr2 INT, attr3 VARCHAR(10) ) ENGINE=ndbcluster; INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413'); -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, @@ -1381,4 +1381,4 @@ select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a; b attr1 9413 9412 drop table test.t1, t2; -drop database test2; +drop database mysqltest; diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result index 0e99c939ea7..c590815b233 100644 --- a/mysql-test/r/ndb_blob.result +++ b/mysql-test/r/ndb_blob.result @@ -1,5 +1,5 @@ drop table if exists t1; -drop database if exists test2; +drop database if exists mysqltest; set autocommit=0; create table t1 ( a int not null primary key, @@ -256,8 +256,8 @@ a b c d 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, @@ -320,3 +320,5 @@ rollback; select count(*) from t1; count(*) 0 +drop table t1; +drop database mysqltest; diff --git a/mysql-test/r/ndb_transaction.result b/mysql-test/r/ndb_transaction.result index 18cbf3e731b..691b91b1d36 100644 --- a/mysql-test/r/ndb_transaction.result +++ b/mysql-test/r/ndb_transaction.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; -drop database if exists test2; +drop database if exists mysqltest; CREATE TABLE t1 ( pk1 INT NOT NULL PRIMARY KEY, attr1 INT NOT NULL @@ -211,8 +211,8 @@ CREATE TABLE t1 ( pk1 INT NOT NULL PRIMARY KEY, attr1 INT NOT NULL ) ENGINE=ndbcluster; -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, @@ -254,4 +254,4 @@ select count(*) from t2; count(*) 0 drop table test.t1, t2; -drop database test2; +drop database mysqltest; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 9ef1202a9a1..e9a5f705fa7 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -334,12 +334,12 @@ prepare stmt1 from ' deallocate prepare never_prepared ' ; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'never_prepared' at line 1 prepare stmt4 from ' use test ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet -prepare stmt3 from ' create database drop_me '; +prepare stmt3 from ' create database mysqltest '; ERROR HY000: This command is not supported in the prepared statement protocol yet -create database drop_me ; -prepare stmt3 from ' drop database drop_me '; +create database mysqltest ; +prepare stmt3 from ' drop database mysqltest '; ERROR HY000: This command is not supported in the prepared statement protocol yet -drop database drop_me ; +drop database mysqltest ; prepare stmt3 from ' grant all on test.t1 to drop_user@localhost identified by ''looser'' '; ERROR HY000: This command is not supported in the prepared statement protocol yet diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index d5f8ac4f293..a60c9269625 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -4,41 +4,41 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists test2; -drop database if exists test3; -create database test2 character set latin2; +drop database if exists mysqltest2; +drop database if exists mysqltest3; +create database mysqltest2 character set latin2; set @@character_set_server=latin5; -create database test3; +create database mysqltest3; --- --master-- -show create database test2; +show create database mysqltest2; Database Create Database -test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */ -show create database test3; +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +show create database mysqltest3; Database Create Database -test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */ +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */ --- --slave-- -show create database test2; +show create database mysqltest2; Database Create Database -test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */ -show create database test3; +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +show create database mysqltest3; Database Create Database -test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */ +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */ set @@collation_server=armscii8_bin; -drop database test3; -create database test3; +drop database mysqltest3; +create database mysqltest3; --- --master-- -show create database test3; +show create database mysqltest3; Database Create Database -test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */ +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */ --- --slave-- -show create database test3; +show create database mysqltest3; Database Create Database -test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */ -use test2; +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */ +use mysqltest2; create table t1 (a int auto_increment primary key, b varchar(100)); set character_set_client=cp850, collation_connection=latin2_croatian_ci; insert into t1 (b) values(@@character_set_server); @@ -57,7 +57,7 @@ a b 5 latin2_croatian_ci --- --slave-- -select * from test2.t1 order by a; +select * from mysqltest2.t1 order by a; a b 1 armscii8 2 armscii8_bin @@ -81,7 +81,7 @@ a b 4 Müller --- --slave-- -select * from test2.t1 order by a; +select * from mysqltest2.t1 order by a; a b 1 latin1_german1_ci 2 Muffler @@ -98,69 +98,69 @@ a b 1 cp850_general_ci --- --slave-- -select * from test2.t1 order by a; +select * from mysqltest2.t1 order by a; a b 1 cp850_general_ci -drop database test2; -drop database test3; +drop database mysqltest2; +drop database mysqltest3; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use `test`; drop database if exists test2 -master-bin.000001 143 Query 1 143 use `test`; drop database if exists test3 -master-bin.000001 207 Query 1 207 use `test`; create database test2 character set latin2 -master-bin.000001 284 Query 1 284 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30 -master-bin.000001 418 Query 1 418 use `test`; create database test3 -master-bin.000001 474 Query 1 474 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64 -master-bin.000001 608 Query 1 608 use `test`; drop database test3 -master-bin.000001 662 Query 1 662 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64 -master-bin.000001 796 Query 1 796 use `test`; create database test3 -master-bin.000001 852 Query 1 852 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 987 Query 1 987 use `test2`; create table t1 (a int auto_increment primary key, b varchar(100)) -master-bin.000001 1089 Query 1 1089 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 1225 Intvar 1 1225 INSERT_ID=1 -master-bin.000001 1253 Query 1 1253 use `test2`; insert into t1 (b) values(@@character_set_server) -master-bin.000001 1338 Query 1 1338 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 1474 Intvar 1 1474 INSERT_ID=2 -master-bin.000001 1502 Query 1 1502 use `test2`; insert into t1 (b) values(@@collation_server) -master-bin.000001 1583 Query 1 1583 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 1719 Intvar 1 1719 INSERT_ID=3 -master-bin.000001 1747 Query 1 1747 use `test2`; insert into t1 (b) values(@@character_set_client) -master-bin.000001 1832 Query 1 1832 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 1968 Intvar 1 1968 INSERT_ID=4 -master-bin.000001 1996 Query 1 1996 use `test2`; insert into t1 (b) values(@@character_set_connection) -master-bin.000001 2085 Query 1 2085 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 2221 Intvar 1 2221 INSERT_ID=5 -master-bin.000001 2249 Query 1 2249 use `test2`; insert into t1 (b) values(@@collation_connection) -master-bin.000001 2334 Query 1 2334 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 2469 Query 1 2469 use `test2`; truncate table t1 -master-bin.000001 2522 Query 1 2522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 2657 Intvar 1 2657 INSERT_ID=1 -master-bin.000001 2685 Query 1 2685 use `test2`; insert into t1 (b) values(@@collation_connection) -master-bin.000001 2770 Query 1 2770 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 2905 Intvar 1 2905 INSERT_ID=2 -master-bin.000001 2933 Query 1 2933 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler")) -master-bin.000001 3021 Query 1 3021 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 3157 Intvar 1 3157 INSERT_ID=3 -master-bin.000001 3185 Query 1 3185 use `test2`; insert into t1 (b) values(@@collation_connection) -master-bin.000001 3270 Query 1 3270 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 3406 Intvar 1 3406 INSERT_ID=4 -master-bin.000001 3434 Query 1 3434 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler")) -master-bin.000001 3522 Query 1 3522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 3658 Intvar 1 3658 INSERT_ID=74 -master-bin.000001 3686 Create_file 1 3686 db=test2;table=t1;file_id=1;block_len=581 -master-bin.000001 4354 Query 1 4354 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 4490 Intvar 1 4490 INSERT_ID=5 -master-bin.000001 4518 Exec_load 1 4518 ;file_id=1 -master-bin.000001 4541 Query 1 4541 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 4677 Query 1 4677 use `test2`; truncate table t1 -master-bin.000001 4730 Query 1 4730 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 4866 Intvar 1 4866 INSERT_ID=1 -master-bin.000001 4894 User var 1 4894 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci -master-bin.000001 4934 Query 1 4934 use `test2`; insert into t1 (b) values(collation(@a)) -master-bin.000001 5010 Query 1 5010 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 5146 Query 1 5146 use `test2`; drop database test2 -master-bin.000001 5201 Query 1 5201 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 -master-bin.000001 5332 Query 1 5332 drop database test3 +master-bin.000001 79 Query 1 79 use `test`; drop database if exists mysqltest2 +master-bin.000001 148 Query 1 148 use `test`; drop database if exists mysqltest3 +master-bin.000001 217 Query 1 217 use `test`; create database mysqltest2 character set latin2 +master-bin.000001 299 Query 1 299 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30 +master-bin.000001 433 Query 1 433 use `test`; create database mysqltest3 +master-bin.000001 494 Query 1 494 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64 +master-bin.000001 628 Query 1 628 use `test`; drop database mysqltest3 +master-bin.000001 687 Query 1 687 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64 +master-bin.000001 821 Query 1 821 use `test`; create database mysqltest3 +master-bin.000001 882 Query 1 882 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 1022 Query 1 1022 use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) +master-bin.000001 1129 Query 1 1129 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 1270 Intvar 1 1270 INSERT_ID=1 +master-bin.000001 1298 Query 1 1298 use `mysqltest2`; insert into t1 (b) values(@@character_set_server) +master-bin.000001 1388 Query 1 1388 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 1529 Intvar 1 1529 INSERT_ID=2 +master-bin.000001 1557 Query 1 1557 use `mysqltest2`; insert into t1 (b) values(@@collation_server) +master-bin.000001 1643 Query 1 1643 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 1784 Intvar 1 1784 INSERT_ID=3 +master-bin.000001 1812 Query 1 1812 use `mysqltest2`; insert into t1 (b) values(@@character_set_client) +master-bin.000001 1902 Query 1 1902 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 2043 Intvar 1 2043 INSERT_ID=4 +master-bin.000001 2071 Query 1 2071 use `mysqltest2`; insert into t1 (b) values(@@character_set_connection) +master-bin.000001 2165 Query 1 2165 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 2306 Intvar 1 2306 INSERT_ID=5 +master-bin.000001 2334 Query 1 2334 use `mysqltest2`; insert into t1 (b) values(@@collation_connection) +master-bin.000001 2424 Query 1 2424 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 2564 Query 1 2564 use `mysqltest2`; truncate table t1 +master-bin.000001 2622 Query 1 2622 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 2762 Intvar 1 2762 INSERT_ID=1 +master-bin.000001 2790 Query 1 2790 use `mysqltest2`; insert into t1 (b) values(@@collation_connection) +master-bin.000001 2880 Query 1 2880 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 3020 Intvar 1 3020 INSERT_ID=2 +master-bin.000001 3048 Query 1 3048 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) +master-bin.000001 3141 Query 1 3141 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 3282 Intvar 1 3282 INSERT_ID=3 +master-bin.000001 3310 Query 1 3310 use `mysqltest2`; insert into t1 (b) values(@@collation_connection) +master-bin.000001 3400 Query 1 3400 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 3541 Intvar 1 3541 INSERT_ID=4 +master-bin.000001 3569 Query 1 3569 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) +master-bin.000001 3662 Query 1 3662 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 3803 Intvar 1 3803 INSERT_ID=74 +master-bin.000001 3831 Create_file 1 3831 db=mysqltest2;table=t1;file_id=1;block_len=581 +master-bin.000001 4504 Query 1 4504 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 4645 Intvar 1 4645 INSERT_ID=5 +master-bin.000001 4673 Exec_load 1 4673 ;file_id=1 +master-bin.000001 4696 Query 1 4696 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 4837 Query 1 4837 use `mysqltest2`; truncate table t1 +master-bin.000001 4895 Query 1 4895 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 5036 Intvar 1 5036 INSERT_ID=1 +master-bin.000001 5064 User var 1 5064 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci +master-bin.000001 5104 Query 1 5104 use `mysqltest2`; insert into t1 (b) values(collation(@a)) +master-bin.000001 5185 Query 1 5185 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 5326 Query 1 5326 use `mysqltest2`; drop database mysqltest2 +master-bin.000001 5391 Query 1 5391 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 +master-bin.000001 5522 Query 1 5522 drop database mysqltest3 set global character_set_server=latin2; ERROR HY000: Binary logging and replication forbid changing the global server character set or collation set global character_set_server=latin2; diff --git a/mysql-test/r/rpl_delete_all.result b/mysql-test/r/rpl_delete_all.result index 97a535490dd..5ed221823e8 100644 --- a/mysql-test/r/rpl_delete_all.result +++ b/mysql-test/r/rpl_delete_all.result @@ -4,12 +4,12 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database test1; -drop database if exists test1; +create database mysqltest; +drop database if exists mysqltest; Warnings: -Note 1008 Can't drop database 'test1'; database doesn't exist -show tables from test1; -ERROR HY000: Can't read dir of './test1/' (Errcode: X) +Note 1008 Can't drop database 'mysqltest'; database doesn't exist +show tables from mysqltest; +ERROR HY000: Can't read dir of './mysqltest/' (Errcode: X) create table t1 (a int); drop table if exists t1; Warnings: diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index b78748b7726..8b52e6efedc 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1,4 +1,5 @@ drop table if exists t1,t2; +drop database if exists mysqltest; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); check table t1 fast; @@ -362,39 +363,39 @@ t1 HEAP 9 Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP 9 Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP 9 Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL drop table t1, t2, t3; -create database test_$1; -show create database test_$1; +create database mysqltest; +show create database mysqltest; Database Create Database -test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */ -create table test_$1.t1(a int); -insert into test_$1.t1 values(1); -grant select on `test_$1`.* to mysqltest_1@localhost; -grant usage on `test_$1`.* to mysqltest_2@localhost; -grant drop on `test_$1`.* to mysqltest_3@localhost; +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +create table mysqltest.t1(a int); +insert into mysqltest.t1 values(1); +grant select on `mysqltest`.* to mysqltest_1@localhost; +grant usage on `mysqltest`.* to mysqltest_2@localhost; +grant drop on `mysqltest`.* to mysqltest_3@localhost; select * from t1; a 1 -show create database test_$1; +show create database mysqltest; Database Create Database -test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ drop table t1; -ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'test_$1' -drop database test_$1; -ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'test_$1' -select * from test_$1.t1; -ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1' -show create database test_$1; -ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1' -drop table test_$1.t1; -ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1' -drop database test_$1; -ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1' -select * from test_$1.t1; -ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'test_$1' -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; +ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' +drop database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' +select * from mysqltest.t1; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' +show create database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' +drop table mysqltest.t1; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' +drop database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' +select * from mysqltest.t1; +ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest' +show create database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest' +drop table mysqltest.t1; +drop database mysqltest; set names binary; delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 30441fb9aae..26c527ca7cb 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -4,7 +4,7 @@ --disable_warnings drop table if exists t1,t2,t3; -drop database if exists test_$1; +drop database if exists mysqltest; --enable_warnings create table t1 (b char(0)); @@ -69,14 +69,14 @@ drop table 1ea10; create table t1 (t1.index int); drop table t1; # Test that we get warning for this -drop database if exists test_$1; -create database test_$1; -create table test_$1.$test1 (a$1 int, $b int, c$ int); -insert into test_$1.$test1 values (1,2,3); -select a$1, $b, c$ from test_$1.$test1; -create table test_$1.test2$ (a int); -drop table test_$1.test2$; -drop database test_$1; +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest.$test1 (a$1 int, $b int, c$ int); +insert into mysqltest.$test1 values (1,2,3); +select a$1, $b, c$ from mysqltest.$test1; +create table mysqltest.test2$ (a int); +drop table mysqltest.test2$; +drop database mysqltest; --error 1103 create table `` (a int); @@ -281,16 +281,16 @@ drop table t3; show create table t3; select * from t3; drop table t2, t3; -create database test_$1; -create table test_$1.t3 like t1; -create temporary table t3 like test_$1.t3; +create database mysqltest; +create table mysqltest.t3 like t1; +create temporary table t3 like mysqltest.t3; show create table t3; create table t2 like t3; show create table t2; select * from t2; create table t3 like t1; --error 1050 -create table t3 like test_$1.t3; +create table t3 like mysqltest.t3; --error 1044,1 create table non_existing_database.t1 like t1; --error 1051 @@ -301,7 +301,7 @@ create temporary table t3 like t1; create table t3 like `a/a`; drop table t1, t2, t3; drop table t3; -drop database test_$1; +drop database mysqltest; # # Test default table type @@ -393,10 +393,10 @@ drop table t1, t2, t3; # Bug #1209 # -create database test_$1; -use test_$1; +create database mysqltest; +use mysqltest; select database(); -drop database test_$1; +drop database mysqltest; select database(); # Connect without a database diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index a24891ab814..a3aa042848d 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -2,7 +2,7 @@ --disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; -drop database if exists test2; +drop database if exists mysqltest; --enable_warnings # @@ -338,8 +338,8 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413'); -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, @@ -353,7 +353,5 @@ select b from test.t1, t2 where c = test.t1.attr2; select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a; drop table test.t1, t2; - -drop database test2; - +drop database mysqltest; diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test index d33168d9da6..36c823bda41 100644 --- a/mysql-test/t/ndb_blob.test +++ b/mysql-test/t/ndb_blob.test @@ -2,7 +2,7 @@ --disable_warnings drop table if exists t1; -drop database if exists test2; +drop database if exists mysqltest; --enable_warnings # @@ -214,8 +214,8 @@ select * from t1 order by a; # multi db -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, @@ -271,5 +271,5 @@ select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3) from t1 order by a; rollback; select count(*) from t1; - ---drop table t1; +drop table t1; +drop database mysqltest; diff --git a/mysql-test/t/ndb_transaction.test b/mysql-test/t/ndb_transaction.test index 9d06d949b2e..f8ed22207ea 100644 --- a/mysql-test/t/ndb_transaction.test +++ b/mysql-test/t/ndb_transaction.test @@ -2,7 +2,7 @@ --disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; -drop database if exists test2; +drop database if exists mysqltest; --enable_warnings # @@ -263,8 +263,8 @@ CREATE TABLE t1 ( attr1 INT NOT NULL ) ENGINE=ndbcluster; -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, @@ -292,7 +292,6 @@ select count(*) from test.t1; select count(*) from t2; drop table test.t1, t2; - -drop database test2; +drop database mysqltest; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 2c86c30f820..084253a106a 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -350,11 +350,11 @@ prepare stmt4 from ' use test ' ; ## create/drop database --error 1295 -prepare stmt3 from ' create database drop_me '; -create database drop_me ; +prepare stmt3 from ' create database mysqltest '; +create database mysqltest ; --error 1295 -prepare stmt3 from ' drop database drop_me '; -drop database drop_me ; +prepare stmt3 from ' drop database mysqltest '; +drop database mysqltest ; ## grant/revoke + drop user --error 1295 diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test index 02bcdf1f5f1..83e7d95e28c 100644 --- a/mysql-test/t/rpl_charset.test +++ b/mysql-test/t/rpl_charset.test @@ -6,41 +6,41 @@ source include/master-slave.inc; --disable_warnings -drop database if exists test2; -drop database if exists test3; +drop database if exists mysqltest2; +drop database if exists mysqltest3; --enable_warnings -create database test2 character set latin2; +create database mysqltest2 character set latin2; set @@character_set_server=latin5; -create database test3; +create database mysqltest3; --disable_query_log select "--- --master--" as ""; --enable_query_log -show create database test2; -show create database test3; +show create database mysqltest2; +show create database mysqltest3; sync_slave_with_master; --disable_query_log select "--- --slave--" as ""; --enable_query_log -show create database test2; -show create database test3; +show create database mysqltest2; +show create database mysqltest3; connection master; set @@collation_server=armscii8_bin; -drop database test3; -create database test3; +drop database mysqltest3; +create database mysqltest3; --disable_query_log select "--- --master--" as ""; --enable_query_log -show create database test3; +show create database mysqltest3; sync_slave_with_master; --disable_query_log select "--- --slave--" as ""; --enable_query_log -show create database test3; +show create database mysqltest3; connection master; -use test2; +use mysqltest2; create table t1 (a int auto_increment primary key, b varchar(100)); set character_set_client=cp850, collation_connection=latin2_croatian_ci; insert into t1 (b) values(@@character_set_server); @@ -59,7 +59,7 @@ sync_slave_with_master; --disable_query_log select "--- --slave--" as ""; --enable_query_log -select * from test2.t1 order by a; +select * from mysqltest2.t1 order by a; connection master; set character_set_client=latin1, collation_connection=latin1_german1_ci; @@ -77,7 +77,7 @@ sync_slave_with_master; --disable_query_log select "--- --slave--" as ""; --enable_query_log -select * from test2.t1 order by a; +select * from mysqltest2.t1 order by a; # See if SET ONE_SHOT gets into binlog when LOAD DATA connection master; @@ -101,11 +101,11 @@ sync_slave_with_master; --disable_query_log select "--- --slave--" as ""; --enable_query_log -select * from test2.t1 order by a; +select * from mysqltest2.t1 order by a; connection master; -drop database test2; -drop database test3; +drop database mysqltest2; +drop database mysqltest3; show binlog events from 79; sync_slave_with_master; diff --git a/mysql-test/t/rpl_delete_all.test b/mysql-test/t/rpl_delete_all.test index 6ca98b34caf..23848720107 100644 --- a/mysql-test/t/rpl_delete_all.test +++ b/mysql-test/t/rpl_delete_all.test @@ -1,14 +1,14 @@ source include/master-slave.inc; connection slave; -create database test1; +create database mysqltest; connection master; -drop database if exists test1; +drop database if exists mysqltest; sync_slave_with_master; # can't read dir --replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" --error 12 -show tables from test1; +show tables from mysqltest; connection slave; create table t1 (a int); diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index de391fbe288..759ed7d22b3 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -4,6 +4,7 @@ --disable_warnings drop table if exists t1,t2; +drop database if exists mysqltest; --enable_warnings create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); @@ -261,42 +262,42 @@ drop table t1, t2, t3; # Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege # -create database test_$1; -show create database test_$1; -create table test_$1.t1(a int); -insert into test_$1.t1 values(1); -grant select on `test_$1`.* to mysqltest_1@localhost; -grant usage on `test_$1`.* to mysqltest_2@localhost; -grant drop on `test_$1`.* to mysqltest_3@localhost; +create database mysqltest; +show create database mysqltest; +create table mysqltest.t1(a int); +insert into mysqltest.t1 values(1); +grant select on `mysqltest`.* to mysqltest_1@localhost; +grant usage on `mysqltest`.* to mysqltest_2@localhost; +grant drop on `mysqltest`.* to mysqltest_3@localhost; -connect (con1,localhost,mysqltest_1,,test_$1); +connect (con1,localhost,mysqltest_1,,mysqltest); connection con1; select * from t1; -show create database test_$1; +show create database mysqltest; --error 1044 drop table t1; --error 1044 -drop database test_$1; +drop database mysqltest; connect (con2,localhost,mysqltest_2,,test); connection con2; --error 1044 -select * from test_$1.t1; +select * from mysqltest.t1; --error 1044 -show create database test_$1; +show create database mysqltest; --error 1044 -drop table test_$1.t1; +drop table mysqltest.t1; --error 1044 -drop database test_$1; +drop database mysqltest; connect (con3,localhost,mysqltest_3,,test); connection con3; --error 1044 -select * from test_$1.t1; +select * from mysqltest.t1; --error 1044 -show create database test_$1; -drop table test_$1.t1; -drop database test_$1; +show create database mysqltest; +drop table mysqltest.t1; +drop database mysqltest; connection default; set names binary; diff --git a/sql/field.h b/sql/field.h index 9cce7b9541b..e12dd60c13b 100644 --- a/sql/field.h +++ b/sql/field.h @@ -908,7 +908,7 @@ public: void reset(void) { charset()->cset->fill(charset(),ptr,field_length,' '); } int store(const char *to,uint length,CHARSET_INFO *charset); int store(longlong nr); - int store(double nr) { return Field_str::store(nr); } + int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */ double val_real(void); longlong val_int(void); String *val_str(String*,String *); @@ -955,7 +955,7 @@ public: uint32 key_length() const { return (uint32) field_length; } int store(const char *to,uint length,CHARSET_INFO *charset); int store(longlong nr); - int store(double nr) { return Field_str::store(nr); } + int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */ double val_real(void); longlong val_int(void); String *val_str(String*,String *); diff --git a/sql/lock.cc b/sql/lock.cc index fab0a61e506..215059b8a46 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -779,7 +779,8 @@ void unlock_global_read_lock(THD *thd) (is_not_commit || \ global_read_lock_blocks_commit)) -bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commit) +bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, + bool is_not_commit) { const char *old_message; bool result= 0, need_exit_cond; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index dede280325d..92364b23461 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2138,7 +2138,10 @@ find_item_in_list(Item *find, List &items, uint *counter, select list over other fields from the tables participating in this select in case of ambiguity. - QQ: Why do we use simple strcmp for table name comparison here ? + We use strcmp for table names and database names as these may be + case sensitive. + In cases where they are not case sensitive, they are always in lower + case. */ if (!my_strcasecmp(system_charset_info, item_field->field_name, field_name) && @@ -2157,10 +2160,12 @@ find_item_in_list(Item *find, List &items, uint *counter, } found= li.ref(); *counter= i; + if (db_name) + break; // Perfect match } } else if (!my_strcasecmp(system_charset_info, item_field->name, - field_name)) + field_name)) { /* If table name was not given we should scan through aliases @@ -2230,7 +2235,7 @@ find_item_in_list(Item *find, List &items, uint *counter, } if (found) return found; - else if (report_error != REPORT_EXCEPT_NOT_FOUND) + if (report_error != REPORT_EXCEPT_NOT_FOUND) { if (report_error == REPORT_ALL_ERRORS) my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index baff7bd604d..4b9f4162aff 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1041,7 +1041,7 @@ static int mysql_test_select(Prepared_statement *stmt, THD *thd= stmt->thd; LEX *lex= stmt->lex; SELECT_LEX_UNIT *unit= &lex->unit; - + int result= 1; DBUG_ENTER("mysql_test_select"); #ifndef NO_EMBEDDED_ACCESS_CHECKS @@ -1087,13 +1087,12 @@ static int mysql_test_select(Prepared_statement *stmt, goto err_prep; } } - unit->cleanup(); - DBUG_RETURN(0); + result= 0; // ok err_prep: unit->cleanup(); err: - DBUG_RETURN(1); + DBUG_RETURN(result); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4ca8008c518..59c587d876f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3220,7 +3220,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, store_key **ref_key= j->ref.key_copy; byte *key_buff=j->ref.key_buff, *null_ref_key= 0; - bool keyuse_uses_no_tables= true; + bool keyuse_uses_no_tables= TRUE; if (ftkey) { j->ref.items[0]=((Item_func*)(keyuse->val))->key_item(); @@ -3240,7 +3240,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, uint maybe_null= test(keyinfo->key_part[i].null_bit); j->ref.items[i]=keyuse->val; // Save for cond removal - keyuse_uses_no_tables= keyuse_uses_no_tables & !keyuse->used_tables; + keyuse_uses_no_tables= keyuse_uses_no_tables && !keyuse->used_tables; if (!keyuse->used_tables && !(join->select_options & SELECT_DESCRIBE)) { // Compare against constant From b93a973b1203b969fef15ef8c10d0d494423f9ed Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Tue, 31 Aug 2004 21:27:58 +0500 Subject: [PATCH 17/52] Added global my_getopt_error_reporter function pointer which is used in the handle_options() function (instead of using additional handle_option() parameter). The default value of the my_getopt_error_reporter is default_reporter(). One can set it to other functions if case of need. --- client/mysql.cc | 2 +- client/mysqladmin.c | 2 +- client/mysqlbinlog.cc | 2 +- client/mysqlcheck.c | 2 +- client/mysqldump.c | 2 +- client/mysqlimport.c | 2 +- client/mysqlmanager-pwgen.c | 2 +- client/mysqlmanagerc.c | 2 +- client/mysqlshow.c | 2 +- client/mysqltest.c | 2 +- extra/my_print_defaults.c | 2 +- extra/mysql_install.c | 2 +- extra/mysql_waitpid.c | 2 +- extra/perror.c | 2 +- extra/resolve_stack_dump.c | 2 +- extra/resolveip.c | 2 +- include/my_getopt.h | 10 ++-- isam/isamchk.c | 2 +- isam/pack_isam.c | 2 +- myisam/mi_test1.c | 2 +- myisam/myisam_ftdump.c | 2 +- myisam/myisamchk.c | 2 +- myisam/myisampack.c | 2 +- mysys/my_getopt.c | 101 ++++++++++++++++++++---------------- sql/gen_lex_hash.cc | 2 +- sql/mysqld.cc | 4 +- tools/mysqlmanager.c | 2 +- 27 files changed, 87 insertions(+), 76 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 73067700656..154695aa9e5 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -759,7 +759,7 @@ static int get_options(int argc, char **argv) opt_max_allowed_packet= *mysql_params->p_max_allowed_packet; opt_net_buffer_length= *mysql_params->p_net_buffer_length; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; diff --git a/client/mysqladmin.c b/client/mysqladmin.c index e2843685d50..3bc11ec0fb0 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -254,7 +254,7 @@ int main(int argc,char *argv[]) mysql_init(&mysql); load_defaults("my",load_default_groups,&argc,&argv); save_argv = argv; /* Save for free_defaults */ - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) { free_defaults(save_argv); exit(ho_error); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 93e0b98b1e5..7c3d22c4900 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -559,7 +559,7 @@ static int parse_args(int *argc, char*** argv) result_file = stdout; load_defaults("my",load_default_groups,argc,argv); - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); return 0; diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 718b92da466..1c5638f3c52 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -273,7 +273,7 @@ static int get_options(int *argc, char ***argv) load_defaults("my", load_default_groups, argc, argv); - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (!what_to_do) diff --git a/client/mysqldump.c b/client/mysqldump.c index c0ef07a7670..6dad8182b87 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -413,7 +413,7 @@ static int get_options(int *argc, char ***argv) md_result_file= stdout; load_defaults("my",load_default_groups,argc,argv); - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 751379591ff..ca53b74c119 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -206,7 +206,7 @@ static int get_options(int *argc, char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (enclosed && opt_enclosed) diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c index dc845008ce0..57d91b52f49 100644 --- a/client/mysqlmanager-pwgen.c +++ b/client/mysqlmanager-pwgen.c @@ -95,7 +95,7 @@ int parse_args(int argc, char** argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); return 0; diff --git a/client/mysqlmanagerc.c b/client/mysqlmanagerc.c index 78485427473..0001a0266e6 100644 --- a/client/mysqlmanagerc.c +++ b/client/mysqlmanagerc.c @@ -133,7 +133,7 @@ int parse_args(int argc, char **argv) load_defaults("my",load_default_groups,&argc,&argv); default_argv= argv; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); return 0; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index cabe55cd95e..1a9aec02955 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -261,7 +261,7 @@ get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (tty_password) diff --git a/client/mysqltest.c b/client/mysqltest.c index df54b60dc97..2ec07692a4d 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2062,7 +2062,7 @@ int parse_args(int argc, char **argv) load_defaults("my",load_default_groups,&argc,&argv); default_argv= argv; - if ((handle_options(&argc, &argv, my_long_options, get_one_option, 0))) + if ((handle_options(&argc, &argv, my_long_options, get_one_option))) exit(1); if (argc > 1) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 515e816f473..f8a7995432b 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -100,7 +100,7 @@ static int get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (*argc < 1) diff --git a/extra/mysql_install.c b/extra/mysql_install.c index ab44e1a055b..e2783f906b9 100644 --- a/extra/mysql_install.c +++ b/extra/mysql_install.c @@ -218,7 +218,7 @@ static int parse_args(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); return 0; diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index 0894d81a5ae..c228cc52c8b 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) progname= argv[0]; - if (handle_options(&argc, &argv, my_long_options, get_one_option, NULL)) + if (handle_options(&argc, &argv, my_long_options, get_one_option)) exit(-1); if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || (t= atoi(argv[1])) <= 0) diff --git a/extra/perror.c b/extra/perror.c index 212b313ade4..b4aeaf00671 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -145,7 +145,7 @@ static int get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (!*argc && !print_all_codes) diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 8b72ab1d864..c54f17a186e 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); /* diff --git a/extra/resolveip.c b/extra/resolveip.c index 23ea34abc42..d3caa9e1d45 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (*argc == 0) diff --git a/include/my_getopt.h b/include/my_getopt.h index f5b847f7dda..e602773e181 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -50,15 +50,15 @@ struct my_option int app_type; /* To be used by an application */ }; -extern char *disabled_my_option; -extern my_bool my_getopt_print_errors; - typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * ); typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... ); +extern char *disabled_my_option; +extern my_bool my_getopt_print_errors; +extern my_error_reporter my_getopt_error_reporter; + extern int handle_options (int *argc, char ***argv, - const struct my_option *longopts, my_get_one_option, - my_error_reporter ); + const struct my_option *longopts, my_get_one_option); extern void my_print_help(const struct my_option *options); extern void my_print_variables(const struct my_option *options); diff --git a/isam/isamchk.c b/isam/isamchk.c index 8603b436841..daa9464eb4f 100644 --- a/isam/isamchk.c +++ b/isam/isamchk.c @@ -670,7 +670,7 @@ static void get_options(register int *argc, register char ***argv) if (isatty(fileno(stdout))) testflag|=T_WRITE_LOOP; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (*argc == 0) diff --git a/isam/pack_isam.c b/isam/pack_isam.c index 59594ccc929..b2e21afc743 100644 --- a/isam/pack_isam.c +++ b/isam/pack_isam.c @@ -353,7 +353,7 @@ static void get_options(int *argc, char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); my_progname= argv[0][0]; diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c index 88e6c5c89d3..8ea97c8e489 100644 --- a/myisam/mi_test1.c +++ b/myisam/mi_test1.c @@ -643,7 +643,7 @@ static void get_options(int argc, char *argv[]) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); return; diff --git a/myisam/myisam_ftdump.c b/myisam/myisam_ftdump.c index 35182bc8abb..838f90feae5 100644 --- a/myisam/myisam_ftdump.c +++ b/myisam/myisam_ftdump.c @@ -66,7 +66,7 @@ int main(int argc,char *argv[]) struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */ MY_INIT(argv[0]); - if (error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)) + if (error=handle_options(&argc, &argv, my_long_options, get_one_option)) exit(error); if (count || dump) verbose=0; diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index e8e85345897..5377ecc18a5 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -677,7 +677,7 @@ static void get_options(register int *argc,register char ***argv) if (isatty(fileno(stdout))) check_param.testflag|=T_WRITE_LOOP; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); /* If using repair, then update checksum if one uses --update-state */ diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 51f8ad1bb11..872fcb49faf 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv) if (isatty(fileno(stdout))) write_loop=1; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (!*argc) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index f9df4afb55d..71f8819756a 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -22,6 +22,9 @@ #include #include +static void default_reporter(enum loglevel level, const char *format, ...); +my_error_reporter my_getopt_error_reporter= &default_reporter; + static int findopt(char *optpat, uint length, const struct my_option **opt_res, char **ffname); @@ -56,7 +59,8 @@ char *disabled_my_option= (char*) "0"; my_bool my_getopt_print_errors= 1; -void default_reporter(enum loglevel level, const char *format, ...) +static void default_reporter(enum loglevel level __attribute__((unused)), + const char *format, ...) { va_list args; va_start(args, format); @@ -76,8 +80,7 @@ void default_reporter(enum loglevel level, const char *format, ...) int handle_options(int *argc, char ***argv, const struct my_option *longopts, - my_get_one_option get_one_option, - my_error_reporter reporter) + my_get_one_option get_one_option) { uint opt_found, argvpos= 0, length, i; my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used, @@ -91,9 +94,6 @@ int handle_options(int *argc, char ***argv, (*argv)++; /* --- || ---- */ init_variables(longopts); - if (! reporter) - reporter= &default_reporter; - for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) { char *cur_arg= *pos; @@ -118,8 +118,9 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: Option '-O' requires an argument\n", progname); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Option '-O' requires an argument\n", + progname); return EXIT_ARGUMENT_REQUIRED; } cur_arg= *pos; @@ -135,9 +136,9 @@ int handle_options(int *argc, char ***argv, if (!*cur_arg) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: Option '--set-variable' requires an argument\n", - progname); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Option '--set-variable' requires an argument\n", + progname); return EXIT_ARGUMENT_REQUIRED; } } @@ -149,9 +150,9 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: Option '--set-variable' requires an argument\n", - progname); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Option '--set-variable' requires an argument\n", + progname); return EXIT_ARGUMENT_REQUIRED; } cur_arg= *pos; @@ -210,10 +211,11 @@ int handle_options(int *argc, char ***argv, if (opt_found > 1) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: ambiguous option '--%s-%s' (--%s-%s)\n", - progname, special_opt_prefix[i], cur_arg, - special_opt_prefix[i], prev_found); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: ambiguous option '--%s-%s' (--%s-%s)\n", + progname, special_opt_prefix[i], + cur_arg, special_opt_prefix[i], + prev_found); return EXIT_AMBIGUOUS_OPTION; } switch (i) { @@ -245,16 +247,20 @@ int handle_options(int *argc, char ***argv, if (must_be_var) { if (my_getopt_print_errors) - reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, - "%s: unknown variable '%s'\n", progname, cur_arg); + my_getopt_error_reporter(option_is_loose ? + WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown variable '%s'\n", + progname, cur_arg); if (!option_is_loose) return EXIT_UNKNOWN_VARIABLE; } else { if (my_getopt_print_errors) - reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, - "%s: unknown option '--%s'\n", progname, cur_arg); + my_getopt_error_reporter(option_is_loose ? + WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown option '--%s'\n", + progname, cur_arg); if (!option_is_loose) return EXIT_UNKNOWN_OPTION; } @@ -270,23 +276,27 @@ int handle_options(int *argc, char ***argv, if (must_be_var) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n", - progname, cur_arg); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: variable prefix '%s' is not unique\n", + progname, cur_arg); return EXIT_VAR_PREFIX_NOT_UNIQUE; } else { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n", - progname, cur_arg, prev_found, optp->name); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: ambiguous option '--%s' (%s, %s)\n", + progname, cur_arg, prev_found, + optp->name); return EXIT_AMBIGUOUS_OPTION; } } if (must_be_var && optp->var_type == GET_NO_ARG) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, "%s: option '%s' cannot take an argument\n", - progname, optp->name); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '%s' cannot take an argument\n", + progname, optp->name); return EXIT_NO_ARGUMENT_ALLOWED; } if (optp->arg_type == NO_ARG) @@ -294,9 +304,9 @@ int handle_options(int *argc, char ***argv, if (optend && optp->var_type != GET_BOOL) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: option '--%s' cannot take an argument\n", - progname, optp->name); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '--%s' cannot take an argument\n", + progname, optp->name); return EXIT_NO_ARGUMENT_ALLOWED; } if (optp->var_type == GET_BOOL) @@ -333,9 +343,9 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: option '--%s' requires an argument\n", - progname, optp->name); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '--%s' requires an argument\n", + progname, optp->name); return EXIT_ARGUMENT_REQUIRED; } argument= *pos; @@ -384,9 +394,9 @@ int handle_options(int *argc, char ***argv, if (!pos[1]) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: option '-%c' requires an argument\n", - progname, optp->id); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '-%c' requires an argument\n", + progname, optp->id); return EXIT_ARGUMENT_REQUIRED; } argument= *++pos; @@ -396,9 +406,9 @@ int handle_options(int *argc, char ***argv, } if ((error= setval(optp, argument, set_maximum_value))) { - reporter(ERROR_LEVEL, - "%s: Error while setting value '%s' to '%s'\n", - progname, argument, optp->name); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Error while setting value '%s' to '%s'\n", + progname, argument, optp->name); return error; } get_one_option(optp->id, optp, argument); @@ -408,8 +418,9 @@ int handle_options(int *argc, char ***argv, if (!opt_found) { if (my_getopt_print_errors) - reporter(ERROR_LEVEL, - "%s: unknown option '-%c'\n", progname, *optend); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: unknown option '-%c'\n", + progname, *optend); return EXIT_UNKNOWN_OPTION; } } @@ -418,9 +429,9 @@ int handle_options(int *argc, char ***argv, } if ((error= setval(optp, argument, set_maximum_value))) { - reporter(ERROR_LEVEL, - "%s: Error while setting value '%s' to '%s'\n", - progname, argument, optp->name); + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Error while setting value '%s' to '%s'\n", + progname, argument, optp->name); return error; } get_one_option(optp->id, optp, argument); diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 72ab1184533..1e78aa35195 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -384,7 +384,7 @@ static int get_options(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) + if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); if (argc >= 1) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1068c5ec9a1..1e682e16d1f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5119,8 +5119,8 @@ static void get_options(int argc,char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, - option_error_reporter))) + my_getopt_error_reporter= option_error_reporter; + if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); #if defined(HAVE_BROKEN_REALPATH) diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 12b5519ae9c..ade6da895c6 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -1333,7 +1333,7 @@ static int parse_args(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); return 0; From 2cf1234ba2d38f2087549377d5e4a182d86a4727 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Tue, 31 Aug 2004 21:10:57 +0300 Subject: [PATCH 18/52] after review patch --- mysql-test/r/negation_elimination.result | 13 ++++++ mysql-test/t/negation_elimination.test | 4 ++ sql/item.h | 4 +- sql/item_cmpfunc.cc | 5 +-- sql/item_cmpfunc.h | 3 ++ sql/mysql_priv.h | 4 +- sql/sql_parse.cc | 36 ++++++++++++++++ sql/sql_select.cc | 54 ------------------------ sql/sql_select.h | 1 - sql/sql_yacc.yy | 20 +++++---- 10 files changed, 74 insertions(+), 70 deletions(-) diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result index a3a2bad7ec6..9193a125cd1 100644 --- a/mysql-test/r/negation_elimination.result +++ b/mysql-test/r/negation_elimination.result @@ -375,4 +375,17 @@ a 13 14 15 +delete from t1 where a > 3; +select a, not(not(a)) from t1; +a not(not(a)) +NULL NULL +0 0 +1 1 +2 1 +3 1 +explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 5 Using where; Using index +Warnings: +Note 1003 select test.t1.a AS `a`,(test.t1.a <> 0) AS `not(not(a))`,((test.t1.a > 2) or test.t1.a) AS `not(a <= 2 and not(a))`,(test.t1.a like _latin1'1') AS `not(a not like "1")`,(test.t1.a in (1,2)) AS `not (a not in (1,2))`,(test.t1.a = 2) AS `not(a != 2)` from test.t1 where test.t1.a having test.t1.a drop table t1; diff --git a/mysql-test/t/negation_elimination.test b/mysql-test/t/negation_elimination.test index 49428cc238b..c50a9678edb 100644 --- a/mysql-test/t/negation_elimination.test +++ b/mysql-test/t/negation_elimination.test @@ -65,4 +65,8 @@ select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17)); explain select * from t1 where ((a between 5 and 15) and (not(a like 10))); select * from t1 where ((a between 5 and 15) and (not(a like 10))); +delete from t1 where a > 3; +select a, not(not(a)) from t1; +explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a)); + drop table t1; diff --git a/sql/item.h b/sql/item.h index 6900fa11b90..742cf934381 100644 --- a/sql/item.h +++ b/sql/item.h @@ -239,6 +239,7 @@ public: virtual void top_level_item() {} virtual void set_result_field(Field *field) {} virtual bool is_result_field() { return 0; } + virtual bool is_bool_func() { return 0; } virtual void save_in_result_field(bool no_conversions) {} virtual void no_rows_in_result() {} virtual Item *copy_or_same(THD *thd) { return this; } @@ -268,8 +269,7 @@ public: virtual void bring_value() {} Field *tmp_table_field_from_field_type(TABLE *table); - - /* Used in sql_select.cc:eliminate_not_funcs() */ + virtual Item *neg_transformer(THD *thd) { return NULL; } void delete_self() { diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index de37e858bac..53ec17fd59d 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2707,9 +2707,6 @@ longlong Item_cond_xor::val_int() IS NULL(a) -> IS NOT NULL(a) IS NOT NULL(a) -> IS NULL(a) - NOTE - This method is used in the eliminate_not_funcs() function. - RETURN New item or NULL if we cannot apply NOT transformation (see Item::neg_transformer()). @@ -2718,7 +2715,7 @@ longlong Item_cond_xor::val_int() Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */ { // We should apply negation elimination to the argument of the NOT function - return eliminate_not_funcs(thd, args[0]); + return args[0]; } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index c3551b35d63..f1a2b11aaa8 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -89,6 +89,7 @@ public: Item_bool_func(Item *a) :Item_int_func(a) {} Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {} Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} + bool is_bool_func() { return 1; } void fix_length_and_dec() { decimals=0; max_length=1; } }; @@ -201,6 +202,7 @@ public: bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; } void print(String *str) { Item_func::print_op(str); } bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); } + bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; } friend class Arg_comparator; @@ -748,6 +750,7 @@ class Item_func_in :public Item_int_func enum Functype functype() const { return IN_FUNC; } const char *func_name() const { return " IN "; } bool nulls_in_row(); + bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } }; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 1949ecf26dc..a9ee6b4b691 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -297,7 +297,8 @@ enum enum_parsing_place { NO_MATTER, IN_HAVING, - SELECT_LIST + SELECT_LIST, + IN_WHERE }; struct st_table; @@ -376,6 +377,7 @@ int delete_precheck(THD *thd, TABLE_LIST *tables); int insert_precheck(THD *thd, TABLE_LIST *tables, bool update); int create_table_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *create_table); +Item *negate_expression(THD *thd, Item *expr); #include "sql_class.h" #include "opt_range.h" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3cb356d42c8..79a011b9501 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5401,3 +5401,39 @@ int create_table_precheck(THD *thd, TABLE_LIST *tables, check_grant(thd, want_priv, create_table, 0, UINT_MAX, 0)) ? 1 : 0); } + + +/* + negate given expression + + SYNOPSIS + negate_expression() + thd therad handler + expr expression for negation + + RETURN + negated expression +*/ + +Item *negate_expression(THD *thd, Item *expr) +{ + Item *negated; + if (expr->type() == Item::FUNC_ITEM && + ((Item_func *) expr)->functype() == Item_func::NOT_FUNC) + { + /* it is NOT(NOT( ... )) */ + Item *arg= ((Item_func *) expr)->arguments()[0]; + enum_parsing_place place= thd->lex->current_select->parsing_place; + if (arg->is_bool_func() || place == IN_WHERE || place == IN_HAVING) + return arg; + /* + if it is not boolean function then we have to emulate value of + not(not(a)), it will be a != 0 + */ + return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1)); + } + + if ((negated= expr->neg_transformer(thd)) != 0) + return negated; + return new Item_func_not(expr); +} diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 701d2597d3d..72e169c77af 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4339,60 +4339,6 @@ propagate_cond_constants(I_List *save_list,COND *and_father, } -/* - Eliminate NOT functions from the condition tree. - - SYNPOSIS - eliminate_not_funcs() - thd thread handler - cond condition tree - - DESCRIPTION - Eliminate NOT functions from the condition tree where it's possible. - Recursively traverse condition tree to find all NOT functions. - Call neg_transformer() method for negated arguments. - - NOTE - If neg_transformer() returned a new condition we call fix_fields(). - We don't delete any items as it's not needed. They will be deleted - later at once. - - RETURN - New condition tree -*/ - -COND *eliminate_not_funcs(THD *thd, COND *cond) -{ - if (!cond) - return cond; - if (cond->type() == Item::COND_ITEM) /* OR or AND */ - { - List_iterator li(*((Item_cond*) cond)->argument_list()); - Item *item; - while ((item= li++)) - { - Item *new_item= eliminate_not_funcs(thd, item); - if (item != new_item) - VOID(li.replace(new_item)); /* replace item with a new condition */ - } - } - else if (cond->type() == Item::FUNC_ITEM && /* 'NOT' operation? */ - ((Item_func*) cond)->functype() == Item_func::NOT_FUNC) - { - COND *new_cond= ((Item_func*) cond)->arguments()[0]->neg_transformer(thd); - if (new_cond) - { - /* - Here we can delete the NOT function. Something like: delete cond; - But we don't need to do it. All items will be deleted later at once. - */ - cond= new_cond; - } - } - return cond; -} - - static COND * optimize_cond(THD *thd, COND *conds, Item::cond_result *cond_value) { diff --git a/sql/sql_select.h b/sql/sql_select.h index 8aca43484d2..34eaa7e272d 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -438,4 +438,3 @@ bool cp_buffer_from_ref(TABLE_REF *ref); bool error_if_full_join(JOIN *join); int report_error(TABLE *table, int error); int safe_index_read(JOIN_TAB *tab); -COND *eliminate_not_funcs(THD *thd, COND *cond); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index afb55463ad1..fa772a9cf11 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2757,13 +2757,11 @@ simple_expr: | '~' expr %prec NEG { $$= new Item_func_bit_neg($2); } | NOT expr %prec NEG { - if (($$= $2->neg_transformer(YYTHD)) == 0) - $$= new Item_func_not($2); + $$= negate_expression(YYTHD, $2); } | '!' expr %prec NEG { - if (($$= $2->neg_transformer(YYTHD)) == 0) - $$= new Item_func_not($2); + $$= negate_expression(YYTHD, $2); } | '(' expr ')' { $$= $2; } | '(' expr ',' expr_list ')' @@ -3606,11 +3604,17 @@ opt_all: where_clause: /* empty */ { Select->where= 0; } - | WHERE expr + | WHERE + { + Select->parsing_place= IN_WHERE; + } + expr { - Select->where= $2; - if ($2) - $2->top_level_item(); + SELECT_LEX *select= Select; + select->where= $3; + select->parsing_place= NO_MATTER; + if ($3) + $3->top_level_item(); } ; From 3f0f1a4fb2b3b1b8e60471a5ef8a83e2b978acda Mon Sep 17 00:00:00 2001 From: "mwagner@here.mwagner.org" <> Date: Tue, 31 Aug 2004 13:29:28 -0500 Subject: [PATCH 19/52] Do-compile: Remove --warnings for mysql-test-run. Devs don't use it, and Serg says it's not needed anymore. --- Build-tools/Do-compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 1650e3d4a09..f92af463a0a 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -361,7 +361,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest) log_timestamp(); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir); safe_cd("${test_dir}/mysql-test"); - check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); + check_system("./mysql-test-run --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); } # From e27714591161894ee4a2e966ff142cb91a547052 Mon Sep 17 00:00:00 2001 From: "patg@krsna.patg.net" <> Date: Tue, 31 Aug 2004 18:59:41 -0700 Subject: [PATCH 20/52] mysqld_safe.sh: bug #5001, added conditional if to test if port set, then only kill the processes for this port, not all processes (in the case of this bug where multiple servers are killed.) The change to the 'grep' to make sure mysqld_safe isn't killed was per Serg's discovery that mysqld_safe would get killed. In my testing, in killing one of the pids for a running server, the "if test ! -f $pid_file" was the case that evaluated as true, so in order to test, I had to comment that block out. --- scripts/mysqld_safe.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 7b77bf449cd..8ad2ee1df4d 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -311,6 +311,7 @@ do fi if test ! -f $pid_file # This is removed if normal shutdown then + echo "STOPPING server from pid file $pid_file" break fi @@ -321,12 +322,24 @@ do # but should work for the rest of the servers. # The only thing is ps x => redhat 5 gives warnings when using ps -x. # kill -9 is used or the process won't react on the kill. - numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD` + if test -n "$mysql_tcp_port" + then + numofproces=`ps xa | grep -v "grep" | grep $ledir/$MYSQLD| grep -c "port=$mysql_tcp_port"` + else + numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD` + fi + echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log I=1 while test "$I" -le "$numofproces" do - PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | sed -n '$p'` + if test -n "$mysql_tcp_port" + then + PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "port=$mysql_tcp_port" | sed -n '$p'` + else + PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | sed -n '$p'` + fi + for T in $PROC do break From 3ee572768be9c4f681133afebec413955a2c745b Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Wed, 1 Sep 2004 12:50:23 +0400 Subject: [PATCH 21/52] Make client_test pass on 64-bit HP-UX11: long is 64 bit, replace all (mis)uses of it with int32. --- tests/client_test.c | 66 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/client_test.c b/tests/client_test.c index ed186837d28..552e49ec862 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -1790,7 +1790,7 @@ static void test_ps_conj_select() MYSQL_STMT *stmt; int rc; MYSQL_BIND bind[2]; - long int int_data; + int32 int_data; char str_data[32]; unsigned long str_length; myheader("test_ps_conj_select"); @@ -3227,7 +3227,7 @@ static void bind_fetch(int row_count) { MYSQL_STMT *stmt; int rc, i, count= row_count; - long data[10]; + int32 data[10]; int8 i8_data; int16 i16_data; int32 i32_data; @@ -4546,7 +4546,7 @@ static void test_multi_stmt() MYSQL_STMT *stmt, *stmt1, *stmt2; int rc; - ulong id; + uint32 id; char name[50]; MYSQL_BIND bind[2]; ulong length[2]; @@ -4605,7 +4605,7 @@ static void test_multi_stmt() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n int_data: %lu(%lu)", id, length[0]); + fprintf(stdout, "\n int_data: %lu(%lu)", (ulong) id, length[0]); fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]); assert(id == 10); assert(strcmp(name, "mysql") == 0); @@ -4634,7 +4634,7 @@ static void test_multi_stmt() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n int_data: %lu(%lu)", id, length[0]); + fprintf(stdout, "\n int_data: %lu(%lu)", (ulong) id, length[0]); fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]); assert(id == 10); assert(strcmp(name, "updated") == 0); @@ -5042,7 +5042,7 @@ static void test_store_result() { MYSQL_STMT *stmt; int rc; - long nData; + int32 nData; char szData[100]; MYSQL_BIND bind[2]; ulong length, length1; @@ -5094,7 +5094,7 @@ static void test_store_result() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 1: %ld, %s(%lu)", nData, szData, length1); + fprintf(stdout, "\n row 1: %ld, %s(%lu)", (long) nData, szData, length1); assert(nData == 10); assert(strcmp(szData, "venu") == 0); assert(length1 == 4); @@ -5102,7 +5102,7 @@ static void test_store_result() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 2: %ld, %s(%lu)", nData, szData, length1); + fprintf(stdout, "\n row 2: %ld, %s(%lu)", (long) nData, szData, length1); assert(nData == 20); assert(strcmp(szData, "mysql") == 0); assert(length1 == 5); @@ -5129,7 +5129,7 @@ static void test_store_result() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 1: %ld, %s(%lu)", nData, szData, length1); + fprintf(stdout, "\n row 1: %ld, %s(%lu)", (long) nData, szData, length1); assert(nData == 10); assert(strcmp(szData, "venu") == 0); assert(length1 == 4); @@ -5137,7 +5137,7 @@ static void test_store_result() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 2: %ld, %s(%lu)", nData, szData, length1); + fprintf(stdout, "\n row 2: %ld, %s(%lu)", (long) nData, szData, length1); assert(nData == 20); assert(strcmp(szData, "mysql") == 0); assert(length1 == 5); @@ -5984,7 +5984,7 @@ static void test_ushort_bug() MYSQL_STMT *stmt; MYSQL_BIND bind[4]; ushort short_value; - ulong long_value; + uint32 long_value; ulong s_length, l_length, ll_length, t_length; ulonglong longlong_value; int rc; @@ -6038,7 +6038,7 @@ static void test_ushort_bug() check_execute(stmt, rc); fprintf(stdout, "\n ushort : %d (%ld)", short_value, s_length); - fprintf(stdout, "\n ulong : %ld (%ld)", long_value, l_length); + fprintf(stdout, "\n ulong : %lu (%ld)", (ulong) long_value, l_length); fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); @@ -6068,7 +6068,7 @@ static void test_sshort_bug() MYSQL_STMT *stmt; MYSQL_BIND bind[4]; short short_value; - long long_value; + int32 long_value; ulong s_length, l_length, ll_length, t_length; ulonglong longlong_value; int rc; @@ -6122,7 +6122,7 @@ static void test_sshort_bug() check_execute(stmt, rc); fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length); - fprintf(stdout, "\n slong : %ld (%ld)", long_value, l_length); + fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length); fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); @@ -6152,7 +6152,7 @@ static void test_stiny_bug() MYSQL_STMT *stmt; MYSQL_BIND bind[4]; short short_value; - long long_value; + int32 long_value; ulong s_length, l_length, ll_length, t_length; ulonglong longlong_value; int rc; @@ -6206,7 +6206,7 @@ static void test_stiny_bug() check_execute(stmt, rc); fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length); - fprintf(stdout, "\n slong : %ld (%ld)", long_value, l_length); + fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length); fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); @@ -7251,7 +7251,7 @@ static void test_fetch_seek() MYSQL_BIND bind[3]; MYSQL_ROW_OFFSET row; int rc; - long c1; + int32 c1; char c2[11], c3[20]; myheader("test_fetch_seek"); @@ -7296,7 +7296,7 @@ static void test_fetch_seek() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 0: %ld, %s, %s", c1, c2, c3); + fprintf(stdout, "\n row 0: %ld, %s, %s", (long) c1, c2, c3); row= mysql_stmt_row_tell(stmt); @@ -7305,21 +7305,21 @@ static void test_fetch_seek() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 2: %ld, %s, %s", c1, c2, c3); + fprintf(stdout, "\n row 2: %ld, %s, %s", (long) c1, c2, c3); row= mysql_stmt_row_seek(stmt, row); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 2: %ld, %s, %s", c1, c2, c3); + fprintf(stdout, "\n row 2: %ld, %s, %s", (long) c1, c2, c3); mysql_stmt_data_seek(stmt, 0); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - fprintf(stdout, "\n row 0: %ld, %s, %s", c1, c2, c3); + fprintf(stdout, "\n row 0: %ld, %s, %s", (long) c1, c2, c3); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); @@ -8050,7 +8050,7 @@ static void test_bug1500() MYSQL_STMT *stmt; MYSQL_BIND bind[3]; int rc; - long int_data[3]= {2, 3, 4}; + int32 int_data[3]= {2, 3, 4}; const char *data; myheader("test_bug1500"); @@ -8836,7 +8836,7 @@ static void test_multi() char *query; MYSQL_BIND bind[1]; int rc, i; - long param= 1; + int32 param= 1; ulong length= 1; myheader("test_multi"); @@ -8888,11 +8888,11 @@ static void test_multi() rc= mysql_stmt_execute(stmt_update); check_execute(stmt_update, rc); - fprintf(stdout, "update %ld\n", param); + fprintf(stdout, "update %ld\n", (long) param); rc= mysql_stmt_execute(stmt_delete); check_execute(stmt_delete, rc); - fprintf(stdout, "delete %ld\n", param); + fprintf(stdout, "delete %ld\n", (long) param); rc= mysql_stmt_execute(stmt_select1); check_execute(stmt_select1, rc); @@ -8966,9 +8966,9 @@ static void test_bind_nagative() char *query; int rc; MYSQL_BIND bind[1]; - long my_val= 0L; + int32 my_val= 0; ulong my_length= 0L; - long my_null= 0L; + my_bool my_null= FALSE; myheader("test_insert_select"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); @@ -9010,9 +9010,9 @@ static void test_derived() MYSQL_STMT *stmt; int rc, i; MYSQL_BIND bind[1]; - long my_val= 0L; + int32 my_val= 0; ulong my_length= 0L; - long my_null= 0L; + my_bool my_null= FALSE; const char *query= "select count(1) from (select f.id from t1 f where f.id=?) as x"; @@ -9520,7 +9520,7 @@ static void test_union_param() MYSQL_BIND bind[2]; char my_val[4]; ulong my_length= 3L; - long my_null= 0L; + my_bool my_null= FALSE; myheader("test_union_param"); strcpy(my_val, "abc"); @@ -9904,7 +9904,7 @@ static void test_bug4079() MYSQL_STMT *stmt; MYSQL_BIND bind[1]; const char *stmt_text; - unsigned long res; + uint32 res; int rc; myheader("test_bug4079"); @@ -10048,7 +10048,7 @@ static void test_bug5126() { MYSQL_STMT *stmt; MYSQL_BIND bind[2]; - long c1, c2; + int32 c1, c2; const char *stmt_text; int rc; @@ -10086,7 +10086,7 @@ static void test_bug5126() rc= mysql_stmt_fetch(stmt); assert(rc == 0); assert(c1 == 8386608 && c2 == 1); - printf("%ld, %ld\n", c1, c2); + printf("%ld, %ld\n", (long) c1, (long) c2); mysql_stmt_close(stmt); } From 4f32cd2b3d415c9ce3d3835f1974428f37a7f235 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Wed, 1 Sep 2004 13:56:33 +0500 Subject: [PATCH 22/52] Move collation aggregation with superset conversion code from Item_bool_func2 into DTCollation to make it reusable for other types of items. --- sql/item.cc | 30 ++++++++++++++++++++++++++++-- sql/item.h | 12 +++++++++--- sql/item_cmpfunc.cc | 24 ++++++++---------------- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 2c98aad2074..e9ef3b6a763 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -265,8 +265,9 @@ CHARSET_INFO *Item::default_charset() return current_thd->variables.collation_connection; } -bool DTCollation::aggregate(DTCollation &dt) +bool DTCollation::aggregate(DTCollation &dt, bool superset_conversion) { + nagg++; if (!my_charset_same(collation, dt.collation)) { /* @@ -280,15 +281,39 @@ bool DTCollation::aggregate(DTCollation &dt) if (derivation <= dt.derivation) ; // Do nothing else - set(dt); + { + set(dt); + strong= nagg; + } } else if (dt.collation == &my_charset_bin) { if (dt.derivation <= derivation) + { set(dt); + strong= nagg; + } else ; // Do nothing } + else if (superset_conversion) + { + if (derivation < dt.derivation && + collation->state & MY_CS_UNICODE) + ; // Do nothing + else if (dt.derivation < derivation && + dt.collation->state & MY_CS_UNICODE) + { + set(dt); + strong= nagg; + } + else + { + // Cannot convert to superset + set(0, DERIVATION_NONE); + return 1; + } + } else { set(0, DERIVATION_NONE); @@ -302,6 +327,7 @@ bool DTCollation::aggregate(DTCollation &dt) else if (dt.derivation < derivation) { set(dt); + strong= nagg; } else { diff --git a/sql/item.h b/sql/item.h index 742cf934381..23c5c844f21 100644 --- a/sql/item.h +++ b/sql/item.h @@ -41,16 +41,22 @@ class DTCollation { public: CHARSET_INFO *collation; enum Derivation derivation; + uint nagg; // Total number of aggregated collations. + uint strong; // Number of the strongest collation. DTCollation() { collation= &my_charset_bin; derivation= DERIVATION_NONE; + nagg= 0; + strong= 0; } DTCollation(CHARSET_INFO *collation_arg, Derivation derivation_arg) { collation= collation_arg; derivation= derivation_arg; + nagg= 0; + strong= 0; } void set(DTCollation &dt) { @@ -66,9 +72,9 @@ public: { collation= collation_arg; } void set(Derivation derivation_arg) { derivation= derivation_arg; } - bool aggregate(DTCollation &dt); - bool set(DTCollation &dt1, DTCollation &dt2) - { set(dt1); return aggregate(dt2); } + bool aggregate(DTCollation &dt, bool superset_conversion= FALSE); + bool set(DTCollation &dt1, DTCollation &dt2, bool superset_conversion= FALSE) + { set(dt1); return aggregate(dt2, superset_conversion); } const char *derivation_name() const { switch(derivation) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 53ec17fd59d..f91bc5c4bc5 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -188,25 +188,17 @@ void Item_bool_func2::fix_length_and_dec() { uint strong= 0; uint weak= 0; + DTCollation coll; - if ((args[0]->collation.derivation < args[1]->collation.derivation) && - !my_charset_same(args[0]->collation.collation, - args[1]->collation.collation) && - (args[0]->collation.collation->state & MY_CS_UNICODE)) - { - weak= 1; - } - else if ((args[1]->collation.derivation < args[0]->collation.derivation) && - !my_charset_same(args[0]->collation.collation, - args[1]->collation.collation) && - (args[1]->collation.collation->state & MY_CS_UNICODE)) - { - strong= 1; - } - - if (strong || weak) + if (args[0]->result_type() == STRING_RESULT && + args[1]->result_type() == STRING_RESULT && + !my_charset_same(args[0]->collation.collation, + args[1]->collation.collation) && + !coll.set(args[0]->collation, args[1]->collation, TRUE)) { Item* conv= 0; + strong= coll.strong; + weak= strong ? 0 : 1; if (args[weak]->type() == STRING_ITEM) { String tmp, cstr; From 9e2e71816f42fbfe9e04a1433dd8e03ad5411c56 Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Wed, 1 Sep 2004 12:36:01 +0200 Subject: [PATCH 23/52] Correct a typo error: cpp symbol is "BIG_TABLES", not "BIG_FILES" (backport from 4.1). --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 7853b615ae0..30a546ec5d9 100644 --- a/configure.in +++ b/configure.in @@ -939,8 +939,8 @@ MAX_CXX_OPTIMIZE="-O3" # workaround for Sun Forte/x86 see BUG#4681 case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in *solaris*-i?86-no) - CFLAGS="$CFLAGS -DBIG_FILES" - CXXFLAGS="$CXXFLAGS -DBIG_FILES" + CFLAGS="$CFLAGS -DBIG_TABLES" + CXXFLAGS="$CXXFLAGS -DBIG_TABLES" ;; *) ;; esac From 153e18a25237c89e347317beffea6ecc0121e894 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Wed, 1 Sep 2004 15:39:15 +0500 Subject: [PATCH 24/52] Allow IN to convert arguments into Unicode in some cases. --- mysql-test/r/func_in.result | 10 +++++++ mysql-test/t/func_in.test | 7 +++++ sql/item_cmpfunc.cc | 54 ++++++++++++++++++++++++++++++++++--- sql/item_func.cc | 12 ++++++--- sql/item_func.h | 7 +++-- 5 files changed, 80 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index f66b3dea94b..374affce8c5 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -148,6 +148,16 @@ id select_type table type possible_keys key key_len ref rows Extra Warnings: Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin'))) drop table t1; +set names utf8; +create table t1 (a char(10) character set utf8 not null); +insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ'); +select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a; +a +ÄÄÄÄ +bbbb +цццц +drop table t1; +set names latin1; select '1.0' in (1,2); '1.0' in (1,2) 1 diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 855a7cbd28f..22079377ad2 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -75,6 +75,13 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin); explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin); drop table t1; +set names utf8; +create table t1 (a char(10) character set utf8 not null); +insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ'); +select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a; +drop table t1; +set names latin1; + select '1.0' in (1,2); select 1 in ('1.0',2); select 1 in (1,'2.0'); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f91bc5c4bc5..4ddb648399a 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1735,12 +1735,58 @@ void Item_func_in::fix_length_and_dec() uint const_itm= 1; agg_cmp_type(&cmp_type, args, arg_count); - if ((cmp_type == STRING_RESULT) && - (agg_arg_collations_for_comparison(cmp_collation, args, arg_count))) - return; - + for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++) const_itm&= arg[0]->const_item(); + + + if (cmp_type == STRING_RESULT) + { + /* + We allow consts character set conversion for + + item IN (const1, const2, const3, ...) + + if item is in a superset for all arguments, + and if it is a stong side according to coercibility rules. + + TODO: add covnersion for non-constant IN values + via creating Item_func_conv_charset(). + */ + + if (agg_arg_collations_for_comparison(cmp_collation, + args, arg_count, TRUE)) + return; + if ((!my_charset_same(args[0]->collation.collation, + cmp_collation.collation) || !const_itm)) + { + if (agg_arg_collations_for_comparison(cmp_collation, + args, arg_count, FALSE)) + return; + } + else + { + /* + Conversion is possible: + All IN arguments are constants. + */ + for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++) + { + if (!my_charset_same(cmp_collation.collation, + arg[0]->collation.collation)) + { + Item_string *conv; + String tmp, cstr, *ostr= arg[0]->val_str(&tmp); + cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), + cmp_collation.collation); + conv= new Item_string(cstr.ptr(),cstr.length(), cstr.charset(), + arg[0]->collation.derivation); + conv->str_value.copy(); + arg[0]= conv; + } + } + } + } /* Row item with NULLs inside can return NULL or FALSE => diff --git a/sql/item_func.cc b/sql/item_func.cc index adcba34d56b..ef845bb8266 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -75,13 +75,16 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname) } -bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count) +bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count, + bool allow_superset_conversion) { uint i; + c.nagg= 0; + c.strong= 0; c.set(av[0]->collation); for (i= 1; i < count; i++) { - if (c.aggregate(av[i]->collation)) + if (c.aggregate(av[i]->collation, allow_superset_conversion)) { my_coll_agg_error(av, count, func_name()); return TRUE; @@ -92,9 +95,10 @@ bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count) bool Item_func::agg_arg_collations_for_comparison(DTCollation &c, - Item **av, uint count) + Item **av, uint count, + bool allow_superset_conv) { - if (agg_arg_collations(c, av, count)) + if (agg_arg_collations(c, av, count, allow_superset_conv)) return TRUE; if (c.derivation == DERIVATION_NONE) diff --git a/sql/item_func.h b/sql/item_func.h index eaa0a044fd6..d45f7244e55 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -140,8 +140,11 @@ public: Field *tmp_table_field(TABLE *t_arg); Item *get_tmp_table_item(THD *thd); - bool agg_arg_collations(DTCollation &c, Item **items, uint nitems); - bool agg_arg_collations_for_comparison(DTCollation &c, Item **items, uint nitems); + bool agg_arg_collations(DTCollation &c, Item **items, uint nitems, + bool allow_superset_conversion= FALSE); + bool agg_arg_collations_for_comparison(DTCollation &c, + Item **items, uint nitems, + bool allow_superset_comversion= FALSE); bool walk(Item_processor processor, byte *arg); }; From 09f3166267b1f188d2c46066390ce85f83c390e9 Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Wed, 1 Sep 2004 14:04:17 +0300 Subject: [PATCH 25/52] row0mysql.c: row_drop_table_for_mysql(): Removed duplicated block of code. --- innobase/row/row0mysql.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index fd12759ad0a..2e8c3adf94f 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -2337,21 +2337,6 @@ row_drop_table_for_mysql( srv_print_innodb_table_monitor = FALSE; } - ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - ut_a(name != NULL); - - if (srv_created_new_raw) { - fputs( - "InnoDB: A new raw disk partition was initialized or\n" - "InnoDB: innodb_force_recovery is on: we do not allow\n" - "InnoDB: database modifications by the user. Shut down\n" - "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n" - "InnoDB: with raw, and innodb_force_... is removed.\n", - stderr); - - return(DB_ERROR); - } - quoted_name = mem_strdupq(name, '\''); namelen = strlen(quoted_name); sql = mem_alloc((sizeof str1) + (sizeof str2) - 2 + 1 + namelen); From 40c0fde904cac1335f93e54fb3e40d4c5dc4fedb Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Wed, 1 Sep 2004 16:41:09 +0300 Subject: [PATCH 26/52] ha_innodb.cc: If ALTER TABLE ... DROP FOREIGN KEY ... fails because of a wrong constraint name, return a table handler error number 150 instead of 152; the value 152 was misleading, as it referred to '152 = Cannot delete a parent row', whereas '150 = Foreign key constraint is incorrectly formed' is less misleading --- sql/ha_innodb.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 3d3aca9cfd5..1572e22d6f7 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -285,8 +285,9 @@ convert_error_code_to_mysql( } else if (error == (int) DB_CANNOT_DROP_CONSTRAINT) { - return(HA_ERR_ROW_IS_REFERENCED); - + return(HA_ERR_CANNOT_ADD_FOREIGN); /* TODO: This is a bit + misleading, a new MySQL error + code should be introduced */ } else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) { return(HA_ERR_CRASHED); From 80879cffe627e555561f07e30779340e1b5c1c58 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Wed, 1 Sep 2004 16:04:01 +0200 Subject: [PATCH 27/52] - removed swedish errmsg.OLD --- sql/share/swedish/errmsg.OLD | 221 ----------------------------------- 1 file changed, 221 deletions(-) delete mode 100644 sql/share/swedish/errmsg.OLD diff --git a/sql/share/swedish/errmsg.OLD b/sql/share/swedish/errmsg.OLD deleted file mode 100644 index 3dd14c8b613..00000000000 --- a/sql/share/swedish/errmsg.OLD +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ - -"hashchk", -"isamchk", -"NO", -"YES", -"Kan inte skapa filen: '%-.64s' (Felkod: %d)", -"Kan inte skapa tabellen: '%-.64s' (Felkod: %d)", -"Kan inte skapa databasen '%-.64s'. (Felkod: %d)", -"Databasen '%-.64s' existerar redan", -"Kan inte radera databasen '%-.64s'. Databasen finns inte", -"Fel vid radering av databasen (Kan inte radera '%-.64s'. Felkod: %d)", -"Fel vid radering av databasen (Kan inte radera biblioteket '%-.64s'. Felkod: %d)", -"Kan inte radera filen: '%-.64s' (Felkod: %d)", -"Hittar inte posten i systemregistret", -"Kan inte läsa filinformationen (stat) från '%-.64s' (Felkod: %d)", -"Kan inte inte läsa aktivt bibliotek. (Felkod: %d)", -"Kan inte låsa filen. (Felkod: %d)", -"Kan inte använda: '%-.64s'. (Felkod: %d)", -"Hittar inte filen: '%-.64s'. (Felkod: %d)", -"Kan inte läsa från bibliotek '%-.64s'. (Felkod: %d)", -"Kan inte byta till: '%-.64s'. (Felkod: %d)", -"Posten har förändrats sedan den lästes i register '%-.64s'", -"Disken är full (%s). Väntar tills det finns ledigt utrymme....", -"Kan inte skriva, dubbel söknyckel i register '%-.64s'", -"Fick fel vid stängning av '%-.64s' (Felkod: %d)", -"Fick fel vid läsning av '%-.64s' (Felkod %d)", -"Kan inte byta namn från '%-.64s' till '%-.64s' (Felkod: %d)", -"Fick fel vid skrivning till '%-.64s' (Felkod %d)", -"'%-.64s' är låst mot användning", -"Sorteringen avbruten", -"Formulär '%-.64s' finns inte i '%-.64s'", -"Fick felkod %d från databashanteraren", -"Registrets databas har inte denna facilitet", -"Hittar inte posten", -"Felaktig fil: '%-.64s'", -"Fatalt fel vid hantering av register '%-.64s'. Kör en reparation", -"Gammal nyckelfil '%-.64s'; Reparera registret", -"'%-.64s' är skyddad mot förändring", -"Oväntat slut på minnet, starta om programmet och försök på nytt (Behövde %d bytes)", -"Sorteringsbufferten räcker inte till. Kontrollera startparametrarna", -"Oväntat filslut vid läsning från '%-.64s' (Felkod: %d)", -"För många anslutningar", -"Fick slut på minnet. Kontrollera ifall mysqld eller någon annan process använder allt tillgängligt minne. Ifall inte, försök använda 'ulimit' eller allokera mera swap", -"Kan inte hitta 'hostname' för din adress", -"Fel vid initiering av kommunikationen med klienten", -"Användare '%-.32s@%-.64s' är ej berättigad att använda databasen %-.64s", -"Användare '%-.32s@%-.64s' är ej berättigad att logga in (Använder lösen: %s)", -"Ingen databas i användning", -"Okänt commando", -"Kolumn '%-.64s' får inte vara NULL", -"Okänd database '%-.64s'", -"Tabellen '%-.64s' finns redan", -"Okänd tabell '%-.64s'", -"Kolumn: '%-.64s' i %s är inte unik", -"Servern går nu ned", -"Okänd kolumn '%-.64s' i %s", -"'%-.64s' finns inte i GROUP BY", -"Kan inte använda GROUP BY med '%-.64s'", -"Kommandot har både sum functions och enkla funktioner", -"Antalet kolumner motsvarar inte antalet värden", -"Kolumn namn '%-.64s' är för långt", -"Kolumn namn '%-64s finns flera gånger", -"Nyckel namn '%-.64s' finns flera gånger", -"Dubbel nyckel '%-.64s' för nyckel: %d", -"Felaktigt kolumn typ för kolumn: '%-.64s'", -"%s nära '%-.64s' på rad %d", -"Frågan var tom", -"Icke unikt tabell/alias: '%-.64s'", -"Ogiltigt DEFAULT värde för '%-.64s'", -"Flera PRIMARY KEY använda", -"För många nycklar använda. Man får ha högst %d nycklar", -"För många nyckel delar använda. Man får ha högst %d nyckeldelar", -"För lång nyckel. Högsta tillåtna nyckellängd är %d", -"Nyckel kolumn '%-.64s' finns inte", -"En BLOB '%-.64s' kan inte vara nyckel med den använda tabellen typen", -"För stor kolumnlängd angiven för '%-.64s' (max= %d). Använd en BLOB instället", -"Det får finnas endast ett AUTO_INCREMENT fält och detta måste vara en nyckel", -"%s: klar att ta emot klienter\n", -"%s: Normal avslutning\n", -"%s: Fick signal %d. Avslutar!\n", -"%s: Avslutning klar\n", -"%s: Stänger av tråd %ld användare: '%-.64s'\n", -"Kan inte skapa IP socket", -"Tabellen '%-.64s' har inget index som motsvarar det angivna i CREATE INDEX. Skapa om tabellen", -"Fält separatorerna är inte emotsägande eller för långa. Kontrollera mot manualen", -"Man kan inte använda fast radlängd med blobs. Använd 'fields terminated by'." -"Textfilen '%' måste finnas i databas biblioteket eller vara läsbar för alla", -"Filen '%-.64s' existerar redan", -"Rader: %ld Bortagna: %ld Dubletter: %ld Varningar: %ld", -"Rader: %ld Dubletter: %ld", -"Felaktig delnyckel. Nyckeldelen är inte en sträng eller den angivna längden är längre än kolumnlängden", -"Man kan inte radera alla fält med ALTER TABLE. Använd DROP TABLE istället", -"Kan inte ta bort '%-.64s'. Kontrollera att fältet/nyckel finns", -"Rader: %ld Dubletter: %ld Varningar: %ld", -"INSERT table '%-.64s' får inte finnas i FROM tabell-listan", -"Finns inget thread med id %lu", -"Du är inte ägare till thread %lu", -"Inga tabeller angivna", -"För många alternativ till kolumn %s för SET", -"Kan inte generera ett unikt filnamn %s.(1-999)\n", -"Tabell '%-.64s' kan inte uppdateras emedan den är låst för läsning", -"Tabell '%-.64s' är inte låst med LOCK TABLES", -"BLOB fält '%-.64s' kan inte ha ett DEFAULT värde" -"Felaktigt databas namn '%-.64s'", -"Felaktigt tabell namn '%-.64s'", -"Den angivna frågan skulle troligen ta mycket long tid! Kontrollar din WHERE och använd SET OPTION SQL_BIG_SELECTS=1 ifall du vill hantera stora joins", -"Oidentifierat fel", -"Okänd procedur: %s", -"Felaktigt antal parametrar till procedur %s", -"Felaktiga parametrar till procedur %s", -"Okänd tabell '%-.64s' i '%-.64s'", -"Fält '%-.64s' är redan använt", -"Felaktig användning av SQL grupp function", -"Tabell '%-.64s' har en extension som inte finns i denna version av MySQL", -"Tabeller måste ha minst 1 kolumn", -"Tabellen '%-.64s' är full", -"Okänt karaktärset: '%-.64s'", -"För många tabeller. MySQL can ha högst %d tabeller i en och samma join" -"För många fält", -"För stor total rad längd. Den högst tillåtna rad-längden, förutom BLOBs, är %d. Ändra några av dina fält till BLOB", -"Tråd-stacken tog slut: Har använt %ld av %ld bytes. Använd 'mysqld -O thread_stack=#' ifall du behöver en större stack", -"Felaktigt referens i OUTER JOIN. Kontrollera ON uttrycket", -"Kolumn '%-.32s' är använd med UNIQUE eller INDEX men är inte definerad med NOT NULL", -"Kan inte ladda funktionen '%-.64s'", -"Kan inte initialisera funktionen '%-.64s'; '%-.80s'", -"Man får inte ange sökväg för dynamiska bibliotek", -"Funktionen '%-.64s' finns redan", -"Kan inte öppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)", -"Hittar inte funktionen '%-.64s' in det dynamiska biblioteket", -"Funktionen '%-.64s' är inte definierad", -"Denna dator '%-.64s' är blockerad pga många felaktig paket. Gör 'mysqladmin flush-hosts' för att ta bort alla blockeringarna", -"Denna dator '%-.64s' har inte privileger att använda denna MySQL server", -"Du använder MySQL som en anonym användare och som sådan får du inte ändra ditt lösenord", -"För att ändra lösenord för andra måste du ha rättigheter att uppdatera mysql databasen", -"Hittade inte användaren i 'user' tabellen", -"Rader: %ld Uppdaterade: %ld Varningar: %ld", -"Kan inte skapa en ny tråd (errno %d)" -"Antalet kolumner motsvarar inte antalet värden på rad: %ld", -"Kunde inte stänga och öppna tabell: '%-.64s', -"Felaktig använding av NULL", -"Fix fel '%-.64s' från REGEXP", -"Man får ha både GROUP kolumner (MIN(),MAX(),COUNT()...) och fält i en fråga om man inte har en GROUP BY del", -"Det finns inget privilegium definierat för användare '%-.32s' på '%-.64s'", -"%-.16s ej tillåtet för '%-.32s@%-.64s' för tabell '%-.64s'", -"%-.16s ej tillåtet för '%-.32s@%-.64s'\n för kolumn '%-.64s' i tabell '%-.64s'", -"Felaktigt GRANT privilegium använt", -"Felaktigt maskinnamn eller användarnamn använt med GRANT", -"Det finns ingen tabell som heter '%-64s.%s'" -"Det finns inget privilegium definierat för användare '%-.32s' på '%-.64s' för tabell '%-.64s'", -"Du kan inte använda detta kommando med denna MySQL version", -"Du har något fel i din syntax", -"DELAYED INSERT tråden kunde inte låsa tabell '%-.64s'", -"Det finns redan 'max_delayed_threads' trådar i använding", -"Avbröt länken för tråd %ld till db: '%-.64s' användare: '%-.64s' (%s)", -"Kommunkationspaketet är större än 'max_allowed_packet'", -"Fick läsfel från klienten vid läsning från 'PIPE'", -"Fick fatalt fel från 'fcntl()'", -"Kommunikationspaketen kom i fel ordning", -"Kunde inte packa up kommunikationspaketet", -"Fick ett fel vid läsning från klienten", -"Fick 'timeout' vid läsning från klienten", -"Fick ett fel vid skrivning till klienten", -"Fick 'timeout' vid skrivning till klienten", -"Resultat strängen är längre än max_allowed_packet", -"Den använda tabell typen kan inte hantera BLOB/TEXT kolumner", -"Den använda tabell typen kan inte hantera AUTO_INCREMENT kolumner", -"INSERT DELAYED kan inte användas med tabell '%-.64s', emedan den är låst med LOCK TABLES", -"Felaktigt column namn '%-.100s'", -"Den använda tabell typen kan inte indexera kolumn '%-.64s'", -"Tabellerna i MERGE tabellen är inte identiskt definierade", -"Kan inte skriva till tabell '%-.64s'; UNIQUE test", -"Du har inte angett en nyckel längd för BLOB '%-.64s'", -"Alla delar av en PRIMARY KEY måste vara NOT NULL; Om du vill ha en nyckel med NULL, använd UNIQUE istället", -"Resultet bestod av mera än en rad", -"Denna tabell typ kräver en PRIMARY KEY", -"Denna version av MySQL är inte kompilerad med RAID", -"Du använder 'säker uppdaterings mod' och försökte uppdatera en table utan en WHERE sats som använder sig av en nyckel", -"Nyckel '%-.64s' finns inte in tabell '%-.64s'", -"Kan inte öppna tabellen", -"Tabellhanteraren för denna tabell kan inte göra check/repair", -"Du får inte utföra detta kommando i en transaktion", -"Fick fel %d vid COMMIT", -"Fick fel %d vid ROLLBACK", -"Fick fel %d vid FLUSH_LOGS", -"Fick fel %d vid CHECKPOINT", -"Avbröt länken för tråd %ld till db: '%-.64s' användare: '%-.32s' Host: '%-.64s' (%.-64s)", -"Tabellhanteraren klarar inte en binär kopiering av tabellen", -"Binärloggen stängdes medan vi gjorde FLUSH MASTER", -"Failed rebuilding the index of dumped table '%-.64s'", -"Fick en master: '%-.64s'", -"Fick nätverksfel vid läsning från master", -"Fick nätverksfel vid skrivning till master", -"Hittar inte ett FULLTEXT index i kolumnlistan", -"Kan inte exekvera kommandot emedan du har en låst tabell eller an aktiv transaktion", -"Okänd system variabel '%-.64'", -"Tabell '%-.64s' är crashad och bör repareras med REPAIR TABLE", -"Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", -"Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", -"Transaktionen krävde mera än 'max_binlog_cache_size' minne. Utöka denna mysqld variabel och försök på nytt", -"Denna operation kan inte göras under replikering; Gör SLAVE STOP först", -"Denna operation kan endast göras under replikering; Konfigurera slaven och gör SLAVE START", -"Servern är inte konfigurerade som en replikations slav. Ändra konfigurationsfilen eller gör CHANGE MASTER TO", -"Kunde inte initializera replications-strukturerna. Kontrollera privilegerna för 'master.info'", -"Kunde inte starta en tråd för replikering", -"Användare '%-.64s' har redan 'max_user_connections' aktiva inloggningar", -"Man kan endast använda konstant-uttryck med SET", -"Fick inte ett lås i tid", -"Antal lås överskrider antalet reserverade lås", -"Updaterings-lås kan inte göras när man använder READ UNCOMMITTED", -"DROP DATABASE är inte tillåtet när man har ett globalt läs-lås", -"CREATE DATABASE är inte tillåtet när man har ett globalt läs-lås", -"Felaktiga argument till %s", -"%-.32s@%-.64s har inte rättigheter att skapa nya användare", -"Fick fel vid anslutning till master: %-.128s", -"Fick fel vid utförande av command på mastern: %-.128s", -"Fick fel vid utförande av %s: %-.128s", -"Felaktig använding av %s and %s", -"SELECT kommandona har olika antal kolumner" -"Kan inte utföra kommandot emedan du har ett READ lås", From ca42de54a1607823836f73b4eb5b30ded2a60c33 Mon Sep 17 00:00:00 2001 From: "miguel@hegel.txg.br" <> Date: Wed, 1 Sep 2004 14:02:11 -0300 Subject: [PATCH 28/52] Fix for bug #5302 --- sql/mysqld.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1e682e16d1f..8236e5d9842 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2669,6 +2669,13 @@ server."); pthread_mutex_unlock(&LOCK_thread_count); } #else +#ifdef __WIN__ + if ( !have_tcpip || opt_disable_networking) + { + sql_print_error("Without TCP/IP or use of --skip-networking results in no available interfaces"); + unireg_abort(1); + } +#endif handle_connections_sockets(0); #ifdef EXTRA_DEBUG2 sql_print_error("Exiting main thread"); From b57e68e6e0d09dd3f40820751fbed0102fa09b63 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Wed, 1 Sep 2004 21:32:24 +0300 Subject: [PATCH 29/52] fixed typo in group_concat printing (BUG#5161) --- mysql-test/r/func_gconcat.result | 6 +++--- sql/item_sum.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 5c98bc5b612..e0883a6297e 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -18,7 +18,7 @@ explain extended select grp,group_concat(c) from t1 group by grp; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort Warnings: -Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp +Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c separator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp select grp,group_concat(a,c) from t1 group by grp; grp group_concat(a,c) 1 1a @@ -93,7 +93,7 @@ explain extended select grp,group_concat(distinct c order by c desc) from t1 gro id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort Warnings: -Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp +Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp select grp,group_concat(c order by c separator ",") from t1 group by grp; grp group_concat(c order by c separator ",") 1 a @@ -113,7 +113,7 @@ explain extended select grp,group_concat(distinct c order by c separator ",") fr id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort Warnings: -Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp +Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp; grp group_concat(distinct c order by c desc separator ",") 1 a diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 0ec8baf97bb..79c1be57625 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2157,7 +2157,7 @@ void Item_func_group_concat::print(String *str) (*order[i]->item)->print(str); } } - str->append(" seperator \'", 12); + str->append(" separator \'", 12); str->append(*separator); str->append("\')", 2); } From fc118875961eb6b656b4ed95a205f1e8eccbdc4c Mon Sep 17 00:00:00 2001 From: "miguel@hegel.txg.br" <> Date: Thu, 2 Sep 2004 01:17:28 -0300 Subject: [PATCH 30/52] Fix for bug #5302 --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8236e5d9842..670e6a5a63e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2672,7 +2672,7 @@ server."); #ifdef __WIN__ if ( !have_tcpip || opt_disable_networking) { - sql_print_error("Without TCP/IP or use of --skip-networking results in no available interfaces"); + sql_print_error("TCP/IP unavailable or disabled with --skip-networking; no available interfaces"); unireg_abort(1); } #endif From 5a817ea665af6b44e19c072e456adf7081994e09 Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Thu, 2 Sep 2004 11:10:26 +0500 Subject: [PATCH 31/52] Addition to the fix for #4815 --- sql/sql_class.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 80b9d6e20bf..b6b9a316cc6 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -854,21 +854,13 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange, { File file; uint option= MY_UNPACK_FILENAME; - char buff[FN_REFLEN]; #ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS option|= MY_REPLACE_DIR; // Force use of db directory #endif - char *cnt= strmake(buff, mysql_real_data_home, FN_REFLEN); - *cnt= FN_LIBCHAR; - cnt++; - cnt= strmake(cnt, thd->db ? thd->db : "", FN_REFLEN - (cnt-buff)); - *cnt= FN_LIBCHAR; - cnt++; - *cnt= 0; - - (void) fn_format(path, exchange->file_name, buff, "", option); + strxnmov(path, FN_REFLEN, mysql_real_data_home, thd->db ? thd->db : ""); + (void) fn_format(path, exchange->file_name, path, "", option); if (!access(path, F_OK)) { my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name); From f37df2fdcc472d179ecfbe9d2b39ac2416721023 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Thu, 2 Sep 2004 12:34:27 +0500 Subject: [PATCH 32/52] Bug#4338 mysql-test-run fails if compiled with non-latin1 character set --- mysql-test/r/system_mysql_db.result | 152 ++++++++++++------------- scripts/mysql_create_system_tables.sh | 35 ++++-- scripts/mysql_fix_privilege_tables.sql | 36 +++--- 3 files changed, 119 insertions(+), 104 deletions(-) diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 3fbe842ce49..ebb24159373 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -18,71 +18,71 @@ user show create table db; Table Create Table db CREATE TABLE `db` ( - `Host` char(60) character set latin1 collate latin1_bin NOT NULL default '', - `Db` char(64) character set latin1 collate latin1_bin NOT NULL default '', - `User` char(16) character set latin1 collate latin1_bin NOT NULL default '', - `Select_priv` enum('N','Y') NOT NULL default 'N', - `Insert_priv` enum('N','Y') NOT NULL default 'N', - `Update_priv` enum('N','Y') NOT NULL default 'N', - `Delete_priv` enum('N','Y') NOT NULL default 'N', - `Create_priv` enum('N','Y') NOT NULL default 'N', - `Drop_priv` enum('N','Y') NOT NULL default 'N', - `Grant_priv` enum('N','Y') NOT NULL default 'N', - `References_priv` enum('N','Y') NOT NULL default 'N', - `Index_priv` enum('N','Y') NOT NULL default 'N', - `Alter_priv` enum('N','Y') NOT NULL default 'N', - `Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N', - `Lock_tables_priv` enum('N','Y') NOT NULL default 'N', + `Host` char(60) collate utf8_bin NOT NULL default '', + `Db` char(64) collate utf8_bin NOT NULL default '', + `User` char(16) collate utf8_bin NOT NULL default '', + `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Database privileges' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges' show create table host; Table Create Table host CREATE TABLE `host` ( - `Host` char(60) character set latin1 collate latin1_bin NOT NULL default '', - `Db` char(64) character set latin1 collate latin1_bin NOT NULL default '', - `Select_priv` enum('N','Y') NOT NULL default 'N', - `Insert_priv` enum('N','Y') NOT NULL default 'N', - `Update_priv` enum('N','Y') NOT NULL default 'N', - `Delete_priv` enum('N','Y') NOT NULL default 'N', - `Create_priv` enum('N','Y') NOT NULL default 'N', - `Drop_priv` enum('N','Y') NOT NULL default 'N', - `Grant_priv` enum('N','Y') NOT NULL default 'N', - `References_priv` enum('N','Y') NOT NULL default 'N', - `Index_priv` enum('N','Y') NOT NULL default 'N', - `Alter_priv` enum('N','Y') NOT NULL default 'N', - `Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N', - `Lock_tables_priv` enum('N','Y') NOT NULL default 'N', + `Host` char(60) collate utf8_bin NOT NULL default '', + `Db` char(64) collate utf8_bin NOT NULL default '', + `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', PRIMARY KEY (`Host`,`Db`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Host privileges; Merged with database privileges' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges' show create table user; Table Create Table user CREATE TABLE `user` ( - `Host` varchar(60) character set latin1 collate latin1_bin NOT NULL default '', - `User` varchar(16) character set latin1 collate latin1_bin NOT NULL default '', - `Password` varchar(41) character set latin1 collate latin1_bin NOT NULL default '', - `Select_priv` enum('N','Y') NOT NULL default 'N', - `Insert_priv` enum('N','Y') NOT NULL default 'N', - `Update_priv` enum('N','Y') NOT NULL default 'N', - `Delete_priv` enum('N','Y') NOT NULL default 'N', - `Create_priv` enum('N','Y') NOT NULL default 'N', - `Drop_priv` enum('N','Y') NOT NULL default 'N', - `Reload_priv` enum('N','Y') NOT NULL default 'N', - `Shutdown_priv` enum('N','Y') NOT NULL default 'N', - `Process_priv` enum('N','Y') NOT NULL default 'N', - `File_priv` enum('N','Y') NOT NULL default 'N', - `Grant_priv` enum('N','Y') NOT NULL default 'N', - `References_priv` enum('N','Y') NOT NULL default 'N', - `Index_priv` enum('N','Y') NOT NULL default 'N', - `Alter_priv` enum('N','Y') NOT NULL default 'N', - `Show_db_priv` enum('N','Y') NOT NULL default 'N', - `Super_priv` enum('N','Y') NOT NULL default 'N', - `Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N', - `Lock_tables_priv` enum('N','Y') NOT NULL default 'N', - `Execute_priv` enum('N','Y') NOT NULL default 'N', - `Repl_slave_priv` enum('N','Y') NOT NULL default 'N', - `Repl_client_priv` enum('N','Y') NOT NULL default 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') NOT NULL default '', + `Host` varchar(60) collate utf8_bin NOT NULL default '', + `User` varchar(16) collate utf8_bin NOT NULL default '', + `Password` varchar(41) collate utf8_bin NOT NULL default '', + `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Reload_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Shutdown_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Process_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `File_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Show_db_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Super_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Repl_slave_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Repl_client_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `ssl_type` enum('','ANY','X509','SPECIFIED') collate utf8_bin NOT NULL default '', `ssl_cipher` blob NOT NULL, `x509_issuer` blob NOT NULL, `x509_subject` blob NOT NULL, @@ -90,41 +90,41 @@ user CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL default '0', `max_connections` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`Host`,`User`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Users and global privileges' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; Table Create Table func CREATE TABLE `func` ( - `name` char(64) character set latin1 collate latin1_bin NOT NULL default '', + `name` char(64) collate utf8_bin NOT NULL default '', `ret` tinyint(1) NOT NULL default '0', - `dl` char(128) NOT NULL default '', - `type` enum('function','aggregate') NOT NULL default 'function', + `dl` char(128) collate utf8_bin NOT NULL default '', + `type` enum('function','aggregate') collate utf8_bin NOT NULL default 'function', PRIMARY KEY (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='User defined functions' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( - `Host` char(60) character set latin1 collate latin1_bin NOT NULL default '', - `Db` char(64) character set latin1 collate latin1_bin NOT NULL default '', - `User` char(16) character set latin1 collate latin1_bin NOT NULL default '', - `Table_name` char(64) character set latin1 collate latin1_bin NOT NULL default '', - `Grantor` char(77) NOT NULL default '', + `Host` char(60) collate utf8_bin NOT NULL default '', + `Db` char(64) collate utf8_bin NOT NULL default '', + `User` char(16) collate utf8_bin NOT NULL default '', + `Table_name` char(64) collate utf8_bin NOT NULL default '', + `Grantor` char(77) collate utf8_bin NOT NULL default '', `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') NOT NULL default '', - `Column_priv` set('Select','Insert','Update','References') NOT NULL default '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') collate utf8_bin NOT NULL default '', + `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table privileges' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges' show create table columns_priv; Table Create Table columns_priv CREATE TABLE `columns_priv` ( - `Host` char(60) character set latin1 collate latin1_bin NOT NULL default '', - `Db` char(64) character set latin1 collate latin1_bin NOT NULL default '', - `User` char(16) character set latin1 collate latin1_bin NOT NULL default '', - `Table_name` char(64) character set latin1 collate latin1_bin NOT NULL default '', - `Column_name` char(64) character set latin1 collate latin1_bin NOT NULL default '', + `Host` char(60) collate utf8_bin NOT NULL default '', + `Db` char(64) collate utf8_bin NOT NULL default '', + `User` char(16) collate utf8_bin NOT NULL default '', + `Table_name` char(64) collate utf8_bin NOT NULL default '', + `Column_name` char(64) collate utf8_bin NOT NULL default '', `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `Column_priv` set('Select','Insert','Update','References') NOT NULL default '', + `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Column privileges' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' show tables; Tables_in_test diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 5a6ea6025f2..e95d65a1224 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -69,6 +69,7 @@ then c_d="$c_d PRIMARY KEY Host (Host,Db,User)," c_d="$c_d KEY User (User)" c_d="$c_d )" + c_d="$c_d CHARACTER SET utf8 COLLATE utf8_bin" c_d="$c_d comment='Database privileges';" i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); @@ -98,6 +99,7 @@ then c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_h="$c_h PRIMARY KEY Host (Host,Db)" c_h="$c_h )" + c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin" c_h="$c_h comment='Host privileges; Merged with database privileges';" fi @@ -141,6 +143,7 @@ then c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL," c_u="$c_u PRIMARY KEY Host (Host,User)" c_u="$c_u )" + c_u="$c_u CHARACTER SET utf8 COLLATE utf8_bin" c_u="$c_u comment='Users and global privileges';" if test "$1" = "test" @@ -180,6 +183,7 @@ then c_f="$c_f type enum ('function','aggregate') NOT NULL," c_f="$c_f PRIMARY KEY (name)" c_f="$c_f )" + c_f="$c_f CHARACTER SET utf8 COLLATE utf8_bin" c_f="$c_f comment='User defined functions';" fi @@ -201,6 +205,7 @@ then c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name)," c_t="$c_t KEY Grantor (Grantor)" c_t="$c_t )" + c_t="$c_t CHARACTER SET utf8 COLLATE utf8_bin" c_t="$c_t comment='Table privileges';" fi @@ -220,6 +225,7 @@ then c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL," c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)" c_c="$c_c )" + c_c="$c_c CHARACTER SET utf8 COLLATE utf8_bin" c_c="$c_c comment='Column privileges';" fi @@ -231,14 +237,15 @@ then c_ht="$c_ht CREATE TABLE help_topic (" c_ht="$c_ht help_topic_id int unsigned not null," - c_ht="$c_ht name nvarchar(64) not null," + c_ht="$c_ht name varchar(64) not null," c_ht="$c_ht help_category_id smallint unsigned not null," c_ht="$c_ht description text not null," c_ht="$c_ht example text not null," - c_ht="$c_ht url nvarchar(128) not null," + c_ht="$c_ht url varchar(128) not null," c_ht="$c_ht primary key (help_topic_id)," c_ht="$c_ht unique index (name)" c_ht="$c_ht )" + c_ht="$c_ht CHARACTER SET utf8" c_ht="$c_ht comment='help topics';" fi @@ -252,12 +259,13 @@ then c_hc="$c_hc CREATE TABLE help_category (" c_hc="$c_hc help_category_id smallint unsigned not null," - c_hc="$c_hc name nvarchar(64) not null," + c_hc="$c_hc name varchar(64) not null," c_hc="$c_hc parent_category_id smallint unsigned null," - c_hc="$c_hc url nvarchar(128) not null," + c_hc="$c_hc url varchar(128) not null," c_hc="$c_hc primary key (help_category_id)," c_hc="$c_hc unique index (name)" c_hc="$c_hc )" + c_hc="$c_hc CHARACTER SET utf8" c_hc="$c_hc comment='help categories';" fi @@ -269,10 +277,11 @@ then c_hk="$c_hk CREATE TABLE help_keyword (" c_hk="$c_hk help_keyword_id int unsigned not null," - c_hk="$c_hk name nvarchar(64) not null," + c_hk="$c_hk name varchar(64) not null," c_hk="$c_hk primary key (help_keyword_id)," c_hk="$c_hk unique index (name)" c_hk="$c_hk )" + c_hk="$c_hk CHARACTER SET utf8" c_hk="$c_hk comment='help keywords';" fi @@ -287,6 +296,7 @@ then c_hr="$c_hr help_keyword_id int unsigned not null references help_keyword," c_hr="$c_hr primary key (help_keyword_id, help_topic_id)" c_hr="$c_hr )" + c_hr="$c_hr CHARACTER SET utf8" c_hr="$c_hr comment='keyword-topic relation';" fi @@ -300,7 +310,8 @@ then c_tzn="$c_tzn Name char(64) NOT NULL," c_tzn="$c_tzn Time_zone_id int unsigned NOT NULL," c_tzn="$c_tzn PRIMARY KEY Name (Name)" - c_tzn="$c_tzn ) DEFAULT CHARACTER SET latin1" + c_tzn="$c_tzn )" + c_tzn="$c_tzn CHARACTER SET utf8" c_tzn="$c_tzn comment='Time zone names';" if test "$1" = "test" @@ -322,7 +333,8 @@ then c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment," c_tz="$c_tz Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL," c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)" - c_tz="$c_tz ) DEFAULT CHARACTER SET latin1" + c_tz="$c_tz )" + c_tz="$c_tz CHARACTER SET utf8" c_tz="$c_tz comment='Time zones';" if test "$1" = "test" @@ -343,7 +355,8 @@ then c_tzt="$c_tzt Transition_time bigint signed NOT NULL," c_tzt="$c_tzt Transition_type_id int unsigned NOT NULL," c_tzt="$c_tzt PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)" - c_tzt="$c_tzt ) DEFAULT CHARACTER SET latin1" + c_tzt="$c_tzt )" + c_tzt="$c_tzt CHARACTER SET utf8" c_tzt="$c_tzt comment='Time zone transitions';" if test "$1" = "test" @@ -565,7 +578,8 @@ then c_tztt="$c_tztt Is_DST tinyint unsigned DEFAULT 0 NOT NULL," c_tztt="$c_tztt Abbreviation char(8) DEFAULT '' NOT NULL," c_tztt="$c_tztt PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)" - c_tztt="$c_tztt ) DEFAULT CHARACTER SET latin1" + c_tztt="$c_tztt )" + c_tztt="$c_tztt CHARACTER SET utf8" c_tztt="$c_tztt comment='Time zone transition types';" if test "$1" = "test" @@ -601,7 +615,8 @@ then c_tzls="$c_tzls Transition_time bigint signed NOT NULL," c_tzls="$c_tzls Correction int signed NOT NULL," c_tzls="$c_tzls PRIMARY KEY TranTime (Transition_time)" - c_tzls="$c_tzls ) DEFAULT CHARACTER SET latin1" + c_tzls="$c_tzls )" + c_tzts="$c_tzts CHARACTER SET utf8" c_tzls="$c_tzls comment='Leap seconds information for time zones';" if test "$1" = "test" diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index b578d8d06f3..a60d987f8b5 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -9,12 +9,12 @@ -- this sql script. -- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql' -ALTER TABLE user type=MyISAM; -ALTER TABLE db type=MyISAM; -ALTER TABLE host type=MyISAM; -ALTER TABLE func type=MyISAM; -ALTER TABLE columns_priv type=MyISAM; -ALTER TABLE tables_priv type=MyISAM; +ALTER TABLE user type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE db type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE host type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE func type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE columns_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE tables_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE user change Password Password char(41) binary not null; ALTER TABLE user add File_priv enum('N','Y') NOT NULL; CREATE TABLE IF NOT EXISTS func ( @@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS func ( dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name) -); +) CHARACTER SET utf8 COLLATE utf8_bin; -- Detect whether or not we had the Grant_priv column SET @hadGrantPriv:=0; @@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS tables_priv ( Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name) -); +) CHARACTER SET utf8 COLLATE utf8_bin; CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) DEFAULT '' NOT NULL, @@ -74,7 +74,7 @@ CREATE TABLE IF NOT EXISTS columns_priv ( Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) -); +) CHARACTER SET utf8 COLLATE utf8_bin; -- @@ -156,7 +156,7 @@ description text not null, example text not null, url varchar(128) not null, primary key (help_topic_id), unique index (name) -) comment='help topics'; +) CHARACTER SET utf8 comment='help topics'; CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, @@ -165,20 +165,20 @@ parent_category_id smallint unsigned null, url varchar(128) not null, primary key (help_category_id), unique index (name) -) comment='help categories'; +) CHARACTER SET utf8 comment='help categories'; CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) -) comment='keyword-topic relation'; +) CHARACTER SET utf8 comment='keyword-topic relation'; CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name varchar(64) not null, primary key (help_keyword_id), unique index (name) -) comment='help keywords'; +) CHARACTER SET utf8 comment='help keywords'; # # Create missing time zone related tables @@ -188,20 +188,20 @@ CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) -) DEFAULT CHARACTER SET latin1 comment='Time zone names'; +) CHARACTER SET utf8 comment='Time zone names'; CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) -) DEFAULT CHARACTER SET latin1 comment='Time zones'; +) CHARACTER SET utf8 comment='Time zones'; CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) -) DEFAULT CHARACTER SET latin1 comment='Time zone transitions'; +) CHARACTER SET utf8 comment='Time zone transitions'; CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, @@ -210,11 +210,11 @@ Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) -) DEFAULT CHARACTER SET latin1 comment='Time zone transition types'; +) CHARACTER SET utf8 comment='Time zone transition types'; CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) -) DEFAULT CHARACTER SET latin1 comment='Leap seconds information for time zones'; +) CHARACTER SET utf8 comment='Leap seconds information for time zones'; From 99f9ff912f425216372fa9eb5217c67d97f9297b Mon Sep 17 00:00:00 2001 From: "mronstrom@mysql.com" <> Date: Thu, 2 Sep 2004 15:13:50 +0200 Subject: [PATCH 33/52] Fix for overwriting of the stack when table name length was larger than 32 bytes. getWords interpreted length as number of words and got number of bytes. --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index d7c4b8a2222..7126842459e 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -5660,7 +5660,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal) signal->getSection(ssPtr,GetTabInfoReq::TABLE_NAME); SimplePropertiesSectionReader r0(ssPtr, getSectionSegmentPool()); r0.reset(); // undo implicit first() - if(r0.getWords((Uint32*)tableName, len)) + if(r0.getWords((Uint32*)tableName, ((len + 3)/4))) memcpy(keyRecord.tableName, tableName, len); else { jam(); From dec44916c141565b41ddfcccdb3e9755b82bd744 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Thu, 2 Sep 2004 16:57:26 +0300 Subject: [PATCH 34/52] After merge fixes --- mysql-test/mysql-test-run.sh | 2 +- mysql-test/r/lowercase_table.result | 12 ++++-------- mysql-test/t/alter_table.test | 4 ++-- mysql-test/t/lowercase_table.test | 2 +- sql/sql_base.cc | 2 +- sql/table.cc | 1 - tests/client_test.c | 2 +- 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 454dc7b327b..b847e8c36e4 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -438,7 +438,7 @@ SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err" CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test" SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M" -export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT +export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK if [ x$SOURCE_DIST = x1 ] ; then MY_BASEDIR=$MYSQL_TEST_DIR diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result index dc8fffa0f90..f0cb4cc3ccf 100644 --- a/mysql-test/r/lowercase_table.result +++ b/mysql-test/r/lowercase_table.result @@ -45,10 +45,11 @@ count(bags.a) drop table t1; create database mysqltest; use MYSQLTEST; +create table t1 (a int); select T1.a from MYSQLTEST.T1; a select t1.a from MYSQLTEST.T1; -Unknown table 't1' in field list +a select mysqltest.t1.* from MYSQLTEST.t1; a select MYSQLTEST.t1.* from MYSQLTEST.t1; @@ -59,7 +60,9 @@ select MYSQLTEST.T1.* from T1; a alter table t1 rename to T1; select MYSQLTEST.t1.* from MYSQLTEST.t1; +a drop database mysqltest; +use test; create table t1 (a int); create table t2 (a int); delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a; @@ -76,10 +79,3 @@ ERROR 42000: Not unique table/alias: 'C' drop table t1, t2; show tables; Tables_in_test -create table t1 (a int); -select TEST.t1.* from TEST.t1; -a -alter table t1 rename to T1; -select TEST.t1.* from TEST.t1; -a -drop table t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 317af337c46..eb35aa90fe2 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -110,14 +110,14 @@ drop database mysqltest; # # Rights for renaming test (Bug #3270) # -connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; --disable_warnings create database mysqltest; --enable_warnings create table mysqltest.t1 (a int,b int,c int); grant all on mysqltest.t1 to mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user1; -- error 1142 alter table t1 rename t2; diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index 602a05a7848..b36d63bfd72 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -39,7 +39,6 @@ create database mysqltest; use MYSQLTEST; create table t1 (a int); select T1.a from MYSQLTEST.T1; ---error 1109 select t1.a from MYSQLTEST.T1; select mysqltest.t1.* from MYSQLTEST.t1; select MYSQLTEST.t1.* from MYSQLTEST.t1; @@ -48,6 +47,7 @@ select MYSQLTEST.T1.* from T1; alter table t1 rename to T1; select MYSQLTEST.t1.* from MYSQLTEST.t1; drop database mysqltest; +use test; # # multiupdate/delete & --lower-case-table-names diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 921e1c1ec42..ac5008717e6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2458,7 +2458,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, 'name' of the item which may be used in the select list */ strmake(name_buff, db_name, sizeof(name_buff)-1); - my_casedn_str(name_buff); + my_casedn_str(files_charset_info, name_buff); db_name= name_buff; } diff --git a/sql/table.cc b/sql/table.cc index eb3e0e8d1a7..8b018d61e5a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1120,7 +1120,6 @@ void append_unescaped(String *res, const char *pos, uint length) res->append(*pos); break; } - pos++; } res->append('\''); } diff --git a/tests/client_test.c b/tests/client_test.c index ed186837d28..ae87fbc70a0 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10189,7 +10189,7 @@ static void get_options(int argc, char **argv) int ho_error; if ((ho_error= handle_options(&argc, &argv, client_test_long_options, - get_one_option, 0))) + get_one_option))) exit(ho_error); if (tty_password) From 2f191db2b11a050e57ebed3bf9eddf7466367784 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Thu, 2 Sep 2004 20:16:01 +0400 Subject: [PATCH 35/52] A fix and test case for Bug#4231 "Wrong result with MYSQL_TIME parameters": when unpacking binary time recieved from client, handle the case when length is 0: it means all MYSQL_TIME members are zero. --- include/my_time.h | 2 ++ libmysql/libmysql.c | 7 ----- sql-common/my_time.c | 10 ++++++ sql/sql_prepare.cc | 50 ++++++++++++++++++------------ tests/client_test.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 116 insertions(+), 27 deletions(-) diff --git a/include/my_time.h b/include/my_time.h index 6c53e39d1d8..d4dbe459c3b 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -58,6 +58,8 @@ void init_time(void); my_time_t my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap); +void set_zero_time(MYSQL_TIME *tm); + C_MODE_END #endif /* _my_time_h_ */ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 380e53d7d47..7d71998f37d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3167,13 +3167,6 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, Fetch and conversion of result set rows (binary protocol). *********************************************************************/ -static void set_zero_time(MYSQL_TIME *tm) -{ - bzero((void *)tm, sizeof(*tm)); - tm->time_type= MYSQL_TIMESTAMP_NONE; -} - - /* Read date, (time, datetime) value from network buffer and store it in MYSQL_TIME structure. diff --git a/sql-common/my_time.c b/sql-common/my_time.c index fcfa2efef61..4b5daf53bea 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -716,3 +716,13 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap) return (my_time_t) tmp; } /* my_system_gmt_sec */ + + +/* Set MYSQL_TIME structure to 0000-00-00 00:00:00.000000 */ + +void set_zero_time(MYSQL_TIME *tm) +{ + bzero((void*) tm, sizeof(*tm)); + tm->time_type= MYSQL_TIMESTAMP_NONE; +} + diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 708ca3a516f..25b6434c184 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -329,15 +329,22 @@ static void set_param_double(Item_param *param, uchar **pos, ulong len) } #ifndef EMBEDDED_LIBRARY + +/* + Read date/time/datetime parameter values from network (binary + protocol). See writing counterparts of these functions in + libmysql.c (store_param_{time,date,datetime}). +*/ + static void set_param_time(Item_param *param, uchar **pos, ulong len) { - ulong length; - uint day; + MYSQL_TIME tm; + ulong length= get_param_length(pos, len); - if ((length= get_param_length(pos, len)) >= 8) + if (length >= 8) { uchar *to= *pos; - TIME tm; + uint day; tm.neg= (bool) to[0]; day= (uint) sint4korr(to+1); @@ -359,21 +366,22 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len) tm.second= 59; } tm.day= tm.year= tm.month= 0; - - param->set_time(&tm, MYSQL_TIMESTAMP_TIME, - MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); } + else + set_zero_time(&tm); + param->set_time(&tm, MYSQL_TIMESTAMP_TIME, + MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); *pos+= length; } static void set_param_datetime(Item_param *param, uchar **pos, ulong len) { - uint length; + MYSQL_TIME tm; + ulong length= get_param_length(pos, len); - if ((length= get_param_length(pos, len)) >= 4) + if (length >= 4) { uchar *to= *pos; - TIME tm; tm.neg= 0; tm.year= (uint) sint2korr(to); @@ -394,21 +402,22 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len) tm.hour= tm.minute= tm.second= 0; tm.second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0; - - param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME, - MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); } + else + set_zero_time(&tm); + param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME, + MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); *pos+= length; } static void set_param_date(Item_param *param, uchar **pos, ulong len) { - ulong length; - - if ((length= get_param_length(pos, len)) >= 4) + MYSQL_TIME tm; + ulong length= get_param_length(pos, len); + + if (length >= 4) { uchar *to= *pos; - TIME tm; /* Note, that though ranges of hour, minute and second are not checked here we rely on them being < 256: otherwise @@ -421,10 +430,11 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len) tm.hour= tm.minute= tm.second= 0; tm.second_part= 0; tm.neg= 0; - - param->set_time(&tm, MYSQL_TIMESTAMP_DATE, - MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); } + else + set_zero_time(&tm); + param->set_time(&tm, MYSQL_TIMESTAMP_DATE, + MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); *pos+= length; } diff --git a/tests/client_test.c b/tests/client_test.c index 552e49ec862..8a14fe3b4f7 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10091,6 +10091,78 @@ static void test_bug5126() } +static void test_bug4231() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind[2]; + MYSQL_TIME tm[2]; + const char *stmt_text; + int rc; + + myheader("test_bug4231"); + + stmt_text= "DROP TABLE IF EXISTS t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt_text= "CREATE TABLE t1 (a int)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt_text= "INSERT INTO t1 VALUES (1)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + stmt_text= "SELECT a FROM t1 WHERE ? = ?"; + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + + /* Bind input buffers */ + bzero(bind, sizeof(bind)); + bzero(tm, sizeof(tm)); + + bind[0].buffer_type= MYSQL_TYPE_TIME; + bind[0].buffer= (void*) tm; + bind[1].buffer_type= MYSQL_TYPE_TIME; + bind[1].buffer= (void*) tm+1; + + mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + /* + First set server-side params to some non-zero non-equal values: + then we will check that they are not used when client sends + new (zero) times. + */ + tm[0].time_type = MYSQL_TIMESTAMP_DATE; + tm[0].year = 2000; + tm[0].month = 1; + tm[0].day = 1; + tm[1]= tm[0]; + --tm[1].year; /* tm[0] != tm[1] */ + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_stmt_fetch(stmt); + + /* binds are unequal, no rows should be returned */ + DBUG_ASSERT(rc == MYSQL_NO_DATA); + + /* Set one of the dates to zero */ + tm[0].year= tm[0].month= tm[0].day= 0; + tm[1]= tm[1]; + mysql_stmt_execute(stmt); + rc= mysql_stmt_fetch(stmt); + DBUG_ASSERT(rc == 0); + + mysql_stmt_close(stmt); + stmt_text= "DROP TABLE t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -10389,6 +10461,8 @@ int main(int argc, char **argv) test_bug4030(); /* test conversion string -> time types in libmysql */ test_bug5126(); /* support for mediumint type in libmysql */ + test_bug4231(); /* proper handling of all-zero times and + dates in the server */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. From 290443298a969cbd28ba1b26cd8f7927e634ab0b Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Thu, 2 Sep 2004 20:06:25 +0300 Subject: [PATCH 36/52] srv0start.c: Change a reference to ibman.php to a reference in the MySQL manual; someone should change the 20 other places in the source code where we still refer to ibman.php --- innobase/srv/srv0start.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 3d49a594924..4a0335086f0 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1587,9 +1587,10 @@ NetWare. */ fprintf(stderr, "InnoDB: You have now successfully upgraded to the multiple tablespaces\n" -"InnoDB: format. You should NOT DOWNGRADE again to an earlier version of\n" -"InnoDB: InnoDB! But if you absolutely need to downgrade, see section 4.6 of\n" -"InnoDB: http://www.innodb.com/ibman.php for instructions.\n"); +"InnoDB: format. You should NOT DOWNGRADE to an earlier version of\n" +"InnoDB: InnoDB! But if you absolutely need to downgrade, see\n" +"InnoDB: http://dev.mysql.com/doc/mysql/en/Multiple_tablespaces.html\n" +"InnoDB: for instructions.\n"); } if (srv_force_recovery == 0) { From f7bc60e0fc0848b441103a0303237031c56949cc Mon Sep 17 00:00:00 2001 From: "paul@kite-hub.kitebird.com" <> Date: Thu, 2 Sep 2004 18:12:05 -0500 Subject: [PATCH 37/52] errmsg.txt: Add GPL comment --- sql/share/czech/errmsg.txt | 16 ++++++++++++++++ sql/share/danish/errmsg.txt | 17 +++++++++++++++-- sql/share/dutch/errmsg.txt | 18 ++++++++++++++++-- sql/share/english/errmsg.txt | 17 +++++++++++++++-- sql/share/estonian/errmsg.txt | 19 ++++++++++++++++--- sql/share/french/errmsg.txt | 17 +++++++++++++++-- sql/share/german/errmsg.txt | 18 ++++++++++++++++-- sql/share/greek/errmsg.txt | 17 +++++++++++++++-- sql/share/hungarian/errmsg.txt | 20 ++++++++++++++++++-- sql/share/italian/errmsg.txt | 17 +++++++++++++++-- sql/share/japanese/errmsg.txt | 19 +++++++++++++++++-- sql/share/korean/errmsg.txt | 17 +++++++++++++++-- sql/share/norwegian-ny/errmsg.txt | 17 +++++++++++++++-- sql/share/norwegian/errmsg.txt | 17 +++++++++++++++-- sql/share/polish/errmsg.txt | 18 ++++++++++++++++-- sql/share/portuguese/errmsg.txt | 19 +++++++++++++++++-- sql/share/romanian/errmsg.txt | 18 ++++++++++++++++-- sql/share/russian/errmsg.txt | 20 ++++++++++++++++++-- sql/share/slovak/errmsg.txt | 17 +++++++++++++++-- sql/share/spanish/errmsg.txt | 19 +++++++++++++++++-- sql/share/swedish/errmsg.txt | 17 +++++++++++++++-- sql/share/ukrainian/errmsg.txt | 20 +++++++++++++++++--- 22 files changed, 350 insertions(+), 44 deletions(-) diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index b6737df91e1..88ecaed386b 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -1,3 +1,19 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + /* Modifikoval Petr -B©najdr, snajdr@pvt.net, snajdr@cpress.cz v.0.01 ISO LATIN-8852-2 diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index ba50c78e92c..6210bf7788c 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Knud Riishøjgård knudriis@post.tele.dk 99 && Carsten H. Pedersen, carsten.pedersen@bitbybit.dk oct. 1999 / aug. 2001. */ diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 1b9c1025e69..c3607f4cd0f 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -1,6 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind +/* Copyright (C) 2003 MySQL AB + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Dutch error messages (share/dutch/errmsg.txt) 2001-08-02 - Arjen Lentz (agl@bitbike.com) Completed earlier partial translation; worked on consistency and spelling. diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index edbf2357ff8..796751210dc 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ "hashchk", "isamchk", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 8ec5d4b29f0..8157a33836e 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -1,9 +1,22 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + /* - Copyright Abandoned 1997 MySQL AB - This file is public domain and comes with NO WARRANTY of any kind Esialgne tõlge: Tõnu Samuel (tonu@spam.ee) Parandanud ja täiendanud: Indrek Siitan (tfr@mysql.com) - */ "hashchk", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 3c5c827aa62..3c88ccc0378 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ "hashchk", "isamchk", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 3960dcc2122..91f3f91a464 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -1,6 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind +/* Copyright (C) 2003 MySQL AB + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Dirk Munzinger (dmun@4t2.com) Version: 07.06.2001 */ diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 3e9a68f2b4b..aff7f8ba3c2 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ "hashchk", "isamchk", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 9da878981b0..60dc3204bb4 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -1,7 +1,23 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Translated by Feher Peter. Forditotta Feher Peter (feherp@mail.matav.hu) 1998 Updated May, 2000 - This file is public domain and comes with NO WARRANTY of any kind */ +*/ "hashchk", "isamchk", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 30dff93ebef..c51c69cf298 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ "hashchk", "isamchk", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 7e267261a2e..fb604923e4e 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -1,5 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* 3.22.10-beta euc-japanese (ujis) text */ diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 1ad5432f4db..764cbb78740 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This È­ÀÏ is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ "hashchk", "isamchk", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 234a53b53fb..424530ecf87 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Roy-Magne Mo rmo@www.hivolda.no 97 */ diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index e582786dc6e..73314ea647b 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Roy-Magne Mo rmo@www.hivolda.no 97 */ diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index a4d11046ea4..f24a54ec8e8 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -1,6 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind +/* Copyright (C) 2003 MySQL AB + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Changed by Jaroslaw Lewandowski Charset ISO-8859-2 */ diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 14c14270dc0..2810ac134b1 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -1,6 +1,21 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + /* Updated by Thiago Delgado Pinto - thiagodp@ieg.com.br - 06.07.2002 */ + "hashchk", "isamchk", "NÃO", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 8d2decdf23f..552b532c0a2 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -1,6 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind +/* Copyright (C) 2003 MySQL AB + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Translated into Romanian by Stefan Saroiu e-mail: tzoompy@cs.washington.edu */ diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 42845b57d76..172ee97c883 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -1,6 +1,22 @@ -/* Copyright 2003 MySQL AB; +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Translation done in 2003 by Egor Egorov; Ensita.NET, http://www.ensita.net/ - This file is public domain and comes with NO WARRANTY of any kind */ +*/ /* charset: KOI8-R */ "hashchk", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 52ed69a238d..8467fad5b11 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Translated from both E n g l i s h & C z e c h error messages diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 2ed3c19b68e..4ab76a64ca7 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -1,5 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Traduccion por Miguel Angel Fernandez Roiz -- LoboCom Sistemas, s.l. From June 28, 2001 translated by Miguel Solorzano miguel@mysql.com */ "hashchk", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 4fd05875b43..352a226ef23 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -1,5 +1,18 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ "hashchk", "isamchk", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 6036f4be2d5..188523ecf45 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -1,6 +1,20 @@ -/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB - * This ÆÁÊÌ is public domain and comes with NO WARRANTY of any kind - * +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* * Ukrainian translation by Roman Festchook * Encoding: KOI8-U * Version: 13/09/2001 mysql-3.23.41 From bb4ccdb1772ba979d132aeda270288033ff86fd2 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Fri, 3 Sep 2004 02:25:27 +0300 Subject: [PATCH 38/52] Remove extra '/' after mysql_real_data_home Add missing parameter to strxnmov() that caused some INTO OUTFILE commands to core dump --- mysql-test/mysql-test-run.sh | 13 ++++++------- mysql-test/r/lowercase_table.result | 1 + mysql-test/r/rename.result | 1 + mysql-test/t/lowercase_table.test | 2 ++ mysql-test/t/rename.test | 2 ++ sql/item_cmpfunc.cc | 1 - sql/sql_class.cc | 3 ++- sql/sql_load.cc | 2 +- sql/sql_table.cc | 2 +- 9 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index b847e8c36e4..41dc3c419f0 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -525,13 +525,6 @@ else fi 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 --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 - - if [ -z "$MASTER_MYSQLD" ] then MASTER_MYSQLD=$MYSQLD @@ -564,6 +557,12 @@ then 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 --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 + MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \ --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \ --tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS" diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result index f0cb4cc3ccf..a30ec0f160c 100644 --- a/mysql-test/r/lowercase_table.result +++ b/mysql-test/r/lowercase_table.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3,t4; +drop table if exists t0,t5,t6,t7,t8,t9; drop database if exists mysqltest; create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result index 9bcf1bc7f97..ec36f015412 100644 --- a/mysql-test/r/rename.result +++ b/mysql-test/r/rename.result @@ -1,4 +1,5 @@ drop table if exists t0,t1,t2,t3,t4; +drop table if exists t0,t5,t6,t7,t8,t9; create table t0 SELECT 1,"table 1"; create table t2 SELECT 2,"table 2"; create table t3 SELECT 3,"table 3"; diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index b36d63bfd72..a9c0c976afc 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -4,6 +4,8 @@ --disable_warnings drop table if exists t1,t2,t3,t4; +# Clear up from other tests (to ensure that SHOW TABLES below is right) +drop table if exists t0,t5,t6,t7,t8,t9; drop database if exists mysqltest; --enable_warnings diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test index bea0641ad23..e6dc6ce9456 100644 --- a/mysql-test/t/rename.test +++ b/mysql-test/t/rename.test @@ -4,6 +4,8 @@ --disable_warnings drop table if exists t0,t1,t2,t3,t4; +# Clear up from other tests (to ensure that SHOW TABLES below is right) +drop table if exists t0,t5,t6,t7,t8,t9; --enable_warnings create table t0 SELECT 1,"table 1"; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 4ddb648399a..f473d242b07 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2752,7 +2752,6 @@ longlong Item_cond_xor::val_int() Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */ { - // We should apply negation elimination to the argument of the NOT function return args[0]; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 36b1b89f6bf..b103ee29095 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -891,7 +891,8 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange, option|= MY_REPLACE_DIR; // Force use of db directory #endif - strxnmov(path, FN_REFLEN, mysql_real_data_home, thd->db ? thd->db : ""); + strxnmov(path, FN_REFLEN, mysql_real_data_home, thd->db ? thd->db : "", + NullS); (void) fn_format(path, exchange->file_name, path, "", option); if (!access(path, F_OK)) { diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 1f4905837f0..1ad9a6aa952 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -183,7 +183,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, strlen(ex->file_name)+strlen(mysql_real_data_home)+strlen(tdb)+3 < FN_REFLEN) { - (void) sprintf(name,"%s/%s/%s",mysql_data_home,tdb,ex->file_name); + (void) sprintf(name,"%s%s/%s",mysql_real_data_home,tdb,ex->file_name); unpack_filename(name,name); /* Convert to system format */ } else diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 408f3408346..58e3bc1d9ac 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1579,7 +1579,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table, reg_ext)) DBUG_RETURN(-1); // protect buffer overflow - my_snprintf(dst_path, sizeof(dst_path), "%s/%s/%s", + my_snprintf(dst_path, sizeof(dst_path), "%s%s/%s", mysql_real_data_home, db, table_name); if (lock_and_wait_for_table_name(thd,table)) From 0fda2f6b97abba0ff0452edf3e73138d33d6cb15 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Fri, 3 Sep 2004 17:47:36 +0500 Subject: [PATCH 39/52] 1. discarded term.h from the distribution 2. changed key_* to el_ley_* in the libedit key.h (because it's in the conflict with the aix definitions) 3. use libedit_term.h instead of term.h in the cmd-line-utils/libedit/el.h 4. added definition of MIN in the cmd-line-utils/libedit/read.c (if it wasn't defined yet) 5. discarded definition of SUNOS macro from configure.in (now we don't include term.h in the el.h at all) --- cmd-line-utils/libedit/Makefile.am | 2 +- cmd-line-utils/libedit/el.c | 4 +- cmd-line-utils/libedit/el.h | 2 +- cmd-line-utils/libedit/key.c | 34 ++++---- cmd-line-utils/libedit/key.h | 25 +++--- cmd-line-utils/libedit/map.c | 37 ++++----- cmd-line-utils/libedit/read.c | 9 ++- cmd-line-utils/libedit/term.c | 68 ++++++++-------- cmd-line-utils/libedit/term.h | 124 ----------------------------- cmd-line-utils/libedit/tty.c | 8 +- configure.in | 7 -- 11 files changed, 97 insertions(+), 223 deletions(-) delete mode 100644 cmd-line-utils/libedit/term.h diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index c6f9ccf06ff..a3d73a7082a 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h noinst_HEADERS = chared.h el.h histedit.h key.h parse.h refresh.h sig.h \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ - search.h tty.h libedit_term.h term.h + search.h tty.h libedit_term.h EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c diff --git a/cmd-line-utils/libedit/el.c b/cmd-line-utils/libedit/el.c index aa4b5c6896b..1b445d40f1c 100644 --- a/cmd-line-utils/libedit/el.c +++ b/cmd-line-utils/libedit/el.c @@ -84,7 +84,7 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr) el_free(el); return NULL; } - (void) key_init(el); + (void) el_key_init(el); (void) map_init(el); if (tty_init(el) == -1) el->el_flags |= NO_TTY; @@ -112,7 +112,7 @@ el_end(EditLine *el) el_reset(el); term_end(el); - key_end(el); + el_key_end(el); map_end(el); tty_end(el); ch_end(el); diff --git a/cmd-line-utils/libedit/el.h b/cmd-line-utils/libedit/el.h index 9e1731c5857..49bd462ad3b 100644 --- a/cmd-line-utils/libedit/el.h +++ b/cmd-line-utils/libedit/el.h @@ -98,7 +98,7 @@ typedef struct el_state_t { #include "tty.h" #include "prompt.h" #include "key.h" -#include "term.h" +#include "libedit_term.h" #include "refresh.h" #include "chared.h" #include "common.h" diff --git a/cmd-line-utils/libedit/key.c b/cmd-line-utils/libedit/key.c index e1e64e328ad..e75db00ce1b 100644 --- a/cmd-line-utils/libedit/key.c +++ b/cmd-line-utils/libedit/key.c @@ -103,14 +103,14 @@ private int key__decode_char(char *, int, int); * Initialize the key maps */ protected int -key_init(EditLine *el) +el_key_init(EditLine *el) { el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ); if (el->el_key.buf == NULL) return (-1); el->el_key.map = NULL; - key_reset(el); + el_key_reset(el); return (0); } @@ -119,7 +119,7 @@ key_init(EditLine *el) * Free the key maps */ protected void -key_end(EditLine *el) +el_key_end(EditLine *el) { el_free((ptr_t) el->el_key.buf); @@ -133,7 +133,7 @@ key_end(EditLine *el) * Associate cmd with a key value */ protected key_value_t * -key_map_cmd(EditLine *el, int cmd) +el_key_map_cmd(EditLine *el, int cmd) { el->el_key.val.cmd = (el_action_t) cmd; @@ -145,7 +145,7 @@ key_map_cmd(EditLine *el, int cmd) * Associate str with a key value */ protected key_value_t * -key_map_str(EditLine *el, char *str) +el_key_map_str(EditLine *el, char *str) { el->el_key.val.str = str; @@ -159,7 +159,7 @@ key_map_str(EditLine *el, char *str) * [Always bind the ansi arrow keys?] */ protected void -key_reset(EditLine *el) +el_key_reset(EditLine *el) { node__put(el, el->el_key.map); @@ -177,7 +177,7 @@ key_reset(EditLine *el) * The last character read is returned in *ch. */ protected int -key_get(EditLine *el, char *ch, key_value_t *val) +el_key_get(EditLine *el, char *ch, key_value_t *val) { return (node_trav(el, el->el_key.map, ch, val)); @@ -191,7 +191,7 @@ key_get(EditLine *el, char *ch, key_value_t *val) * out str or a unix command. */ protected void -key_add(EditLine *el, const char *key, key_value_t *val, int ntype) +el_key_add(EditLine *el, const char *key, key_value_t *val, int ntype) { if (key[0] == '\0') { @@ -219,7 +219,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype) * */ protected void -key_clear(EditLine *el, el_action_t *map, const char *in) +el_key_clear(EditLine *el, el_action_t *map, const char *in) { if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) && @@ -227,7 +227,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in) el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) || (map == el->el_map.alt && el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN))) - (void) key_delete(el, in); + (void) el_key_delete(el, in); } @@ -236,7 +236,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in) * they exists. */ protected int -key_delete(EditLine *el, const char *key) +el_key_delete(EditLine *el, const char *key) { if (key[0] == '\0') { @@ -257,7 +257,7 @@ key_delete(EditLine *el, const char *key) * Print entire el->el_key.map if null */ protected void -key_print(EditLine *el, const char *key) +el_key_print(EditLine *el, const char *key) { /* do nothing if el->el_key.map is empty and null key specified */ @@ -504,7 +504,7 @@ node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt) if (str[1] == 0) { el->el_key.buf[ncnt + 1] = '"'; el->el_key.buf[ncnt + 2] = '\0'; - key_kprint(el, el->el_key.buf, + el_key_kprint(el, el->el_key.buf, &ptr->val, ptr->type); return (0); } else @@ -552,7 +552,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt) /* print this key and function */ el->el_key.buf[ncnt + 1] = '"'; el->el_key.buf[ncnt + 2] = '\0'; - key_kprint(el, el->el_key.buf, &ptr->val, ptr->type); + el_key_kprint(el, el->el_key.buf, &ptr->val, ptr->type); } else (void) node_enum(el, ptr->next, ncnt + 1); @@ -568,7 +568,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt) * function specified by val */ protected void -key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype) +el_key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype) { el_bindings_t *fp; char unparsbuf[EL_BUFSIZ]; @@ -579,7 +579,7 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype) case XK_STR: case XK_EXE: (void) fprintf(el->el_outfile, fmt, key, - key__decode_str(val->str, unparsbuf, + el_key__decode_str(val->str, unparsbuf, ntype == XK_STR ? "\"\"" : "[]")); break; case XK_CMD: @@ -644,7 +644,7 @@ key__decode_char(char *buf, int cnt, int ch) * Make a printable version of the ey */ protected char * -key__decode_str(const char *str, char *buf, const char *sep) +el_key__decode_str(const char *str, char *buf, const char *sep) { char *b; const char *p; diff --git a/cmd-line-utils/libedit/key.h b/cmd-line-utils/libedit/key.h index 80d8626b894..9d83d7c2521 100644 --- a/cmd-line-utils/libedit/key.h +++ b/cmd-line-utils/libedit/key.h @@ -62,18 +62,19 @@ typedef struct el_key_t { #define XK_NOD 2 #define XK_EXE 3 -protected int key_init(EditLine *); -protected void key_end(EditLine *); -protected key_value_t *key_map_cmd(EditLine *, int); -protected key_value_t *key_map_str(EditLine *, char *); -protected void key_reset(EditLine *); -protected int key_get(EditLine *, char *, key_value_t *); -protected void key_add(EditLine *, const char *, key_value_t *, int); -protected void key_clear(EditLine *, el_action_t *, const char *); -protected int key_delete(EditLine *, const char *); -protected void key_print(EditLine *, const char *); -protected void key_kprint(EditLine *, const char *, key_value_t *, +protected int el_key_init(EditLine *); +protected void el_key_end(EditLine *); +protected key_value_t *el_key_map_cmd(EditLine *, int); +protected key_value_t *el_key_map_str(EditLine *, char *); +protected void el_key_reset(EditLine *); +protected int el_key_get(EditLine *, char *, key_value_t *); +protected void el_key_add(EditLine *, + const char *, key_value_t *, int); +protected void el_key_clear(EditLine *, el_action_t *, const char *); +protected int el_key_delete(EditLine *, const char *); +protected void el_key_print(EditLine *, const char *); +protected void el_key_kprint(EditLine *, const char *, key_value_t *, int); -protected char *key__decode_str(const char *, char *, const char *); +protected char *el_key__decode_str(const char *, char *, const char *); #endif /* _h_el_key */ diff --git a/cmd-line-utils/libedit/map.c b/cmd-line-utils/libedit/map.c index e044e875382..a16625311ae 100644 --- a/cmd-line-utils/libedit/map.c +++ b/cmd-line-utils/libedit/map.c @@ -1011,7 +1011,8 @@ map_init_meta(EditLine *el) break; default: buf[1] = i & 0177; - key_add(el, buf, key_map_cmd(el, (int) map[i]), XK_CMD); + el_key_add(el, buf, + el_key_map_cmd(el, (int) map[i]), XK_CMD); break; } map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN; @@ -1033,7 +1034,7 @@ map_init_vi(EditLine *el) el->el_map.type = MAP_VI; el->el_map.current = el->el_map.key; - key_reset(el); + el_key_reset(el); for (i = 0; i < N_KEYS; i++) { key[i] = vii[i]; @@ -1062,7 +1063,7 @@ map_init_emacs(EditLine *el) el->el_map.type = MAP_EMACS; el->el_map.current = el->el_map.key; - key_reset(el); + el_key_reset(el); for (i = 0; i < N_KEYS; i++) { key[i] = emacs[i]; @@ -1075,7 +1076,7 @@ map_init_emacs(EditLine *el) buf[0] = CONTROL('X'); buf[1] = CONTROL('X'); buf[2] = 0; - key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD); + el_key_add(el, buf, el_key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD); tty_bind_char(el, 1); term_bind_arrow(el); @@ -1132,7 +1133,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in) el_bindings_t *bp; if (in[0] == '\0' || in[1] == '\0') { - (void) key__decode_str(in, outbuf, ""); + (void) el_key__decode_str(in, outbuf, ""); for (bp = el->el_map.help; bp->name != NULL; bp++) if (bp->func == map[(unsigned char) *in]) { (void) fprintf(el->el_outfile, @@ -1140,7 +1141,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in) return; } } else - key_print(el, in); + el_key_print(el, in); } @@ -1162,20 +1163,20 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last) if (first == last) (void) fprintf(el->el_outfile, "%-15s-> is undefined\n", - key__decode_str(firstbuf, unparsbuf, STRQQ)); + el_key__decode_str(firstbuf, unparsbuf, STRQQ)); return; } for (bp = el->el_map.help; bp->name != NULL; bp++) { if (bp->func == map[first]) { if (first == last) { (void) fprintf(el->el_outfile, "%-15s-> %s\n", - key__decode_str(firstbuf, unparsbuf, STRQQ), + el_key__decode_str(firstbuf, unparsbuf, STRQQ), bp->name); } else { (void) fprintf(el->el_outfile, "%-4s to %-7s-> %s\n", - key__decode_str(firstbuf, unparsbuf, STRQQ), - key__decode_str(lastbuf, extrabuf, STRQQ), + el_key__decode_str(firstbuf, unparsbuf, STRQQ), + el_key__decode_str(lastbuf, extrabuf, STRQQ), bp->name); } return; @@ -1229,7 +1230,7 @@ map_print_all_keys(EditLine *el) map_print_some_keys(el, el->el_map.alt, prev, i - 1); (void) fprintf(el->el_outfile, "Multi-character bindings\n"); - key_print(el, ""); + el_key_print(el, ""); (void) fprintf(el->el_outfile, "Arrow key bindings\n"); term_print_arrow(el, ""); } @@ -1322,9 +1323,9 @@ map_bind(EditLine *el, int argc, const char **argv) return (-1); } if (in[1]) - (void) key_delete(el, in); + (void) el_key_delete(el, in); else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) - (void) key_delete(el, in); + (void) el_key_delete(el, in); else map[(unsigned char) *in] = ED_UNASSIGNED; return (0); @@ -1352,9 +1353,9 @@ map_bind(EditLine *el, int argc, const char **argv) return (-1); } if (key) - term_set_arrow(el, in, key_map_str(el, out), ntype); + term_set_arrow(el, in, el_key_map_str(el, out), ntype); else - key_add(el, in, key_map_str(el, out), ntype); + el_key_add(el, in, el_key_map_str(el, out), ntype); map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN; break; @@ -1365,13 +1366,13 @@ map_bind(EditLine *el, int argc, const char **argv) return (-1); } if (key) - term_set_arrow(el, in, key_map_str(el, out), ntype); + term_set_arrow(el, in, el_key_map_str(el, out), ntype); else { if (in[1]) { - key_add(el, in, key_map_cmd(el, cmd), ntype); + el_key_add(el, in, el_key_map_cmd(el, cmd), ntype); map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN; } else { - key_clear(el, map, in); + el_key_clear(el, map, in); map[(unsigned char) *in] = cmd; } } diff --git a/cmd-line-utils/libedit/read.c b/cmd-line-utils/libedit/read.c index 7567a81e875..5eaa83bf482 100644 --- a/cmd-line-utils/libedit/read.c +++ b/cmd-line-utils/libedit/read.c @@ -198,6 +198,10 @@ read_preread(EditLine *el) return (0); #ifdef FIONREAD + +#ifndef MIN // definition of MIN is lacking on hpux.. +#define MIN(x,y) (((x)<(y))?(x):(y)) +#endif (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); if (chrs > 0) { char buf[EL_BUFSIZ]; @@ -262,7 +266,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch) cmd = el->el_map.current[(unsigned char) *ch]; if (cmd == ED_SEQUENCE_LEAD_IN) { key_value_t val; - switch (key_get(el, ch, &val)) { + switch (el_key_get(el, ch, &val)) { case XK_CMD: cmd = val.cmd; break; @@ -459,7 +463,8 @@ el_gets(EditLine *el, int *nread) #endif /* DEBUG_READ */ break; } - if ((uint)cmdnum >= (uint)(el->el_map.nfunc)) { /* BUG CHECK command */ + if ((unsigned int)cmdnum >= (unsigned int)(el->el_map.nfunc)) + { /* BUG CHECK command */ #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, "ERROR: illegal command from key 0%o\r\n", ch); diff --git a/cmd-line-utils/libedit/term.c b/cmd-line-utils/libedit/term.c index f5fb93394d8..1f90c783a2b 100644 --- a/cmd-line-utils/libedit/term.c +++ b/cmd-line-utils/libedit/term.c @@ -67,10 +67,6 @@ __RCSID("$NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $"); #include "el.h" -/* Solaris's term.h does horrid things. */ -#if (defined(HAVE_TERM_H) && !defined(SUNOS)) -#include -#endif #include #include @@ -1079,32 +1075,32 @@ term_reset_arrow(EditLine *el) static const char stOH[] = {033, 'O', 'H', '\0'}; static const char stOF[] = {033, 'O', 'F', '\0'}; - key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); - key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); - key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); - key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); - key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); - key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); - key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); - key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); - key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); - key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); - key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); - key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); + el_key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); + el_key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); + el_key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); + el_key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); + el_key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); + el_key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); + el_key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); + el_key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); + el_key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); + el_key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); + el_key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); + el_key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); if (el->el_map.type == MAP_VI) { - key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); - key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); - key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); - key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); - key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); - key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); - key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); - key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); - key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); - key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); - key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); - key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); + el_key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); + el_key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); + el_key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); + el_key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); + el_key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); + el_key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); + el_key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); + el_key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); + el_key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); + el_key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); + el_key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); + el_key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); } } @@ -1158,7 +1154,7 @@ term_print_arrow(EditLine *el, const char *name) for (i = 0; i < A_K_NKEYS; i++) if (*name == '\0' || strcmp(name, arrow[i].name) == 0) if (arrow[i].type != XK_NOD) - key_kprint(el, arrow[i].name, &arrow[i].fun, + el_key_kprint(el, arrow[i].name, &arrow[i].fun, arrow[i].type); } @@ -1199,20 +1195,20 @@ term_bind_arrow(EditLine *el) * unassigned key. */ if (arrow[i].type == XK_NOD) - key_clear(el, map, p); + el_key_clear(el, map, p); else { if (p[1] && (dmap[j] == map[j] || map[j] == ED_SEQUENCE_LEAD_IN)) { - key_add(el, p, &arrow[i].fun, + el_key_add(el, p, &arrow[i].fun, arrow[i].type); map[j] = ED_SEQUENCE_LEAD_IN; } else if (map[j] == ED_UNASSIGNED) { - key_clear(el, map, p); + el_key_clear(el, map, p); if (arrow[i].type == XK_CMD) map[j] = arrow[i].fun.cmd; else - key_add(el, p, &arrow[i].fun, - arrow[i].type); + el_key_add(el, p, &arrow[i].fun, + arrow[i].type); } } } @@ -1245,6 +1241,8 @@ term__flush(void) /* term_telltc(): * Print the current termcap characteristics */ +char *el_key__decode_str(const char *, char *, const char *); + protected int /*ARGSUSED*/ term_telltc(EditLine *el, int argc __attribute__((unused)), @@ -1272,7 +1270,7 @@ term_telltc(EditLine *el, int argc __attribute__((unused)), (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", t->long_name, t->name, *ts && **ts ? - key__decode_str(*ts, upbuf, "") : "(empty)"); + el_key__decode_str(*ts, upbuf, "") : "(empty)"); (void) fputc('\n', el->el_outfile); return (0); } diff --git a/cmd-line-utils/libedit/term.h b/cmd-line-utils/libedit/term.h deleted file mode 100644 index 47e08e84bf4..00000000000 --- a/cmd-line-utils/libedit/term.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $NetBSD: term.h,v 1.13 2002/03/18 16:01:00 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)term.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.term.h: Termcap header - */ -#ifndef _h_el_term -#define _h_el_term - -#include "histedit.h" - -typedef struct { /* Symbolic function key bindings */ - const char *name; /* name of the key */ - int key; /* Index in termcap table */ - key_value_t fun; /* Function bound to it */ - int type; /* Type of function */ -} fkey_t; - -typedef struct { - coord_t t_size; /* # lines and cols */ - int t_flags; -#define TERM_CAN_INSERT 0x001 /* Has insert cap */ -#define TERM_CAN_DELETE 0x002 /* Has delete cap */ -#define TERM_CAN_CEOL 0x004 /* Has CEOL cap */ -#define TERM_CAN_TAB 0x008 /* Can use tabs */ -#define TERM_CAN_ME 0x010 /* Can turn all attrs. */ -#define TERM_CAN_UP 0x020 /* Can move up */ -#define TERM_HAS_META 0x040 /* Has a meta key */ -#define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */ -#define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */ - char *t_buf; /* Termcap buffer */ - int t_loc; /* location used */ - char **t_str; /* termcap strings */ - int *t_val; /* termcap values */ - char *t_cap; /* Termcap buffer */ - fkey_t *t_fkey; /* Array of keys */ -} el_term_t; - -/* - * fKey indexes - */ -#define A_K_DN 0 -#define A_K_UP 1 -#define A_K_LT 2 -#define A_K_RT 3 -#define A_K_HO 4 -#define A_K_EN 5 -#define A_K_NKEYS 6 - -protected void term_move_to_line(EditLine *, int); -protected void term_move_to_char(EditLine *, int); -protected void term_clear_EOL(EditLine *, int); -protected void term_overwrite(EditLine *, const char *, int); -protected void term_insertwrite(EditLine *, char *, int); -protected void term_deletechars(EditLine *, int); -protected void term_clear_screen(EditLine *); -protected void term_beep(EditLine *); -protected int term_change_size(EditLine *, int, int); -protected int term_get_size(EditLine *, int *, int *); -protected int term_init(EditLine *); -protected void term_bind_arrow(EditLine *); -protected void term_print_arrow(EditLine *, const char *); -protected int term_clear_arrow(EditLine *, const char *); -protected int term_set_arrow(EditLine *, const char *, key_value_t *, int); -protected void term_end(EditLine *); -protected int term_set(EditLine *, const char *); -protected int term_settc(EditLine *, int, const char **); -protected int term_telltc(EditLine *, int, const char **); -protected int term_echotc(EditLine *, int, const char **); -protected int term__putc(int); -protected void term__flush(void); - -/* - * Easy access macros - */ -#define EL_FLAGS (el)->el_term.t_flags - -#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) -#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) -#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) -#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) -#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) -#define EL_HAS_META (EL_FLAGS & TERM_HAS_META) -#define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS) -#define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS) - -#endif /* _h_el_term */ diff --git a/cmd-line-utils/libedit/tty.c b/cmd-line-utils/libedit/tty.c index 5253fdf87a7..fe81762fb82 100644 --- a/cmd-line-utils/libedit/tty.c +++ b/cmd-line-utils/libedit/tty.c @@ -784,15 +784,15 @@ tty_bind_char(EditLine *el, int force) if (new[0] == old[0] && !force) continue; /* Put the old default binding back, and set the new binding */ - key_clear(el, map, (char *)old); + el_key_clear(el, map, (char *)old); map[old[0]] = dmap[old[0]]; - key_clear(el, map, (char *)new); + el_key_clear(el, map, (char *)new); /* MAP_VI == 1, MAP_EMACS == 0... */ map[new[0]] = tp->bind[el->el_map.type]; if (dalt) { - key_clear(el, alt, (char *)old); + el_key_clear(el, alt, (char *)old); alt[old[0]] = dalt[old[0]]; - key_clear(el, alt, (char *)new); + el_key_clear(el, alt, (char *)new); alt[new[0]] = tp->bind[el->el_map.type + 1]; } } diff --git a/configure.in b/configure.in index 3d0da156c94..8c125cd9c8b 100644 --- a/configure.in +++ b/configure.in @@ -1875,13 +1875,6 @@ else fi AC_SUBST(TERMCAP_LIB) -# for libedit 2.6.7 -case "${host}" in - *-*-solaris2*) - AC_DEFINE_UNQUOTED(SUNOS, 1, [macro for libedit-2.6.7, current platform is solaris-2]) - ;; -esac - LIBEDIT_LOBJECTS="" AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"]) AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"]) From f91ca0bd660bd1d2449a3d5b3141b1a4d7dfb443 Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Fri, 3 Sep 2004 19:59:29 +0500 Subject: [PATCH 40/52] A fix (Bug #4980: union statement with () union () order by produces wrong explain). --- mysql-test/r/union.result | 9 ++++++++- mysql-test/t/union.test | 9 +++++++++ sql/sql_union.cc | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 4b9555c334b..8f33bc4c316 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -88,7 +88,6 @@ explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a l table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t2 ALL NULL NULL NULL NULL 4 Using filesort -t1 ALL NULL NULL NULL NULL 4 (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; a b 1 a @@ -424,8 +423,16 @@ create table t1 select a from t1 union select a from t2; INSERT TABLE 't1' isn't allowed in FROM table list select a from t1 union select a from t2 order by t2.a; Unknown column 't2.a' in 'ORDER BY' +drop table t1; drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; * 1 2 +create table t1 (a int); +insert into t1 values (0), (3), (1), (2); +explain (select * from t1) union (select * from t1) order by a; +table type possible_keys key key_len ref rows Extra +t1 ALL NULL NULL NULL NULL 4 +t1 ALL NULL NULL NULL NULL 4 +drop table t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index c978aef9ce0..65b062d663f 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -228,6 +228,7 @@ create temporary table t1 select a from t1 union select a from t2; create table t1 select a from t1 union select a from t2; --error 1054 select a from t1 union select a from t2 order by t2.a; +drop table t1; # Drop temporary table drop table t1,t2; # @@ -236,3 +237,11 @@ drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; +# +# Bug #4980: problem with explain +# + +create table t1 (a int); +insert into t1 values (0), (3), (1), (2); +explain (select * from t1) union (select * from t1) order by a; +drop table t1; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 8088737c0de..f79ff7967db 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -148,6 +148,10 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) { ha_rows records_at_start; lex->select=sl; +#if MYSQL_VERSION_ID < 40100 + if (describe && sl->linkage == NOT_A_SELECT) + break; // Skip extra item in case of 'explain' +#endif /* Don't use offset for the last union if there is no braces */ if (sl != lex_sl) { From e66d0fa7d83339880c72e84181794c9851babe18 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 3 Sep 2004 17:20:00 +0200 Subject: [PATCH 41/52] add engine=MyISAM to all create table statements in mysql_create_system_tables, just in case --- scripts/mysql_create_system_tables.sh | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 5a6ea6025f2..04d3a1e07e1 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -68,7 +68,7 @@ then c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_d="$c_d PRIMARY KEY Host (Host,Db,User)," c_d="$c_d KEY User (User)" - c_d="$c_d )" + c_d="$c_d ) engine=MyISAM" c_d="$c_d comment='Database privileges';" i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); @@ -97,7 +97,7 @@ then c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_h="$c_h PRIMARY KEY Host (Host,Db)" - c_h="$c_h )" + c_h="$c_h ) engine=MyISAM" c_h="$c_h comment='Host privileges; Merged with database privileges';" fi @@ -140,7 +140,7 @@ then c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL," c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL," c_u="$c_u PRIMARY KEY Host (Host,User)" - c_u="$c_u )" + c_u="$c_u ) engine=MyISAM" c_u="$c_u comment='Users and global privileges';" if test "$1" = "test" @@ -179,7 +179,7 @@ then c_f="$c_f dl char(128) DEFAULT '' NOT NULL," c_f="$c_f type enum ('function','aggregate') NOT NULL," c_f="$c_f PRIMARY KEY (name)" - c_f="$c_f )" + c_f="$c_f ) engine=MyISAM" c_f="$c_f comment='User defined functions';" fi @@ -200,7 +200,7 @@ then c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL," c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name)," c_t="$c_t KEY Grantor (Grantor)" - c_t="$c_t )" + c_t="$c_t ) engine=MyISAM" c_t="$c_t comment='Table privileges';" fi @@ -219,7 +219,7 @@ then c_c="$c_c Timestamp timestamp(14)," c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL," c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)" - c_c="$c_c )" + c_c="$c_c ) engine=MyISAM" c_c="$c_c comment='Column privileges';" fi @@ -238,7 +238,7 @@ then c_ht="$c_ht url nvarchar(128) not null," c_ht="$c_ht primary key (help_topic_id)," c_ht="$c_ht unique index (name)" - c_ht="$c_ht )" + c_ht="$c_ht ) engine=MyISAM" c_ht="$c_ht comment='help topics';" fi @@ -257,7 +257,7 @@ then c_hc="$c_hc url nvarchar(128) not null," c_hc="$c_hc primary key (help_category_id)," c_hc="$c_hc unique index (name)" - c_hc="$c_hc )" + c_hc="$c_hc ) engine=MyISAM" c_hc="$c_hc comment='help categories';" fi @@ -272,7 +272,7 @@ then c_hk="$c_hk name nvarchar(64) not null," c_hk="$c_hk primary key (help_keyword_id)," c_hk="$c_hk unique index (name)" - c_hk="$c_hk )" + c_hk="$c_hk ) engine=MyISAM" c_hk="$c_hk comment='help keywords';" fi @@ -286,7 +286,7 @@ then c_hr="$c_hr help_topic_id int unsigned not null references help_topic," c_hr="$c_hr help_keyword_id int unsigned not null references help_keyword," c_hr="$c_hr primary key (help_keyword_id, help_topic_id)" - c_hr="$c_hr )" + c_hr="$c_hr ) engine=MyISAM" c_hr="$c_hr comment='keyword-topic relation';" fi @@ -300,7 +300,7 @@ then c_tzn="$c_tzn Name char(64) NOT NULL," c_tzn="$c_tzn Time_zone_id int unsigned NOT NULL," c_tzn="$c_tzn PRIMARY KEY Name (Name)" - c_tzn="$c_tzn ) DEFAULT CHARACTER SET latin1" + c_tzn="$c_tzn ) engine=MyISAM DEFAULT CHARACTER SET latin1" c_tzn="$c_tzn comment='Time zone names';" if test "$1" = "test" @@ -322,7 +322,7 @@ then c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment," c_tz="$c_tz Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL," c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)" - c_tz="$c_tz ) DEFAULT CHARACTER SET latin1" + c_tz="$c_tz ) engine=MyISAM DEFAULT CHARACTER SET latin1" c_tz="$c_tz comment='Time zones';" if test "$1" = "test" @@ -343,7 +343,7 @@ then c_tzt="$c_tzt Transition_time bigint signed NOT NULL," c_tzt="$c_tzt Transition_type_id int unsigned NOT NULL," c_tzt="$c_tzt PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)" - c_tzt="$c_tzt ) DEFAULT CHARACTER SET latin1" + c_tzt="$c_tzt ) engine=MyISAM DEFAULT CHARACTER SET latin1" c_tzt="$c_tzt comment='Time zone transitions';" if test "$1" = "test" @@ -565,7 +565,7 @@ then c_tztt="$c_tztt Is_DST tinyint unsigned DEFAULT 0 NOT NULL," c_tztt="$c_tztt Abbreviation char(8) DEFAULT '' NOT NULL," c_tztt="$c_tztt PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)" - c_tztt="$c_tztt ) DEFAULT CHARACTER SET latin1" + c_tztt="$c_tztt ) engine=MyISAM DEFAULT CHARACTER SET latin1" c_tztt="$c_tztt comment='Time zone transition types';" if test "$1" = "test" @@ -601,7 +601,7 @@ then c_tzls="$c_tzls Transition_time bigint signed NOT NULL," c_tzls="$c_tzls Correction int signed NOT NULL," c_tzls="$c_tzls PRIMARY KEY TranTime (Transition_time)" - c_tzls="$c_tzls ) DEFAULT CHARACTER SET latin1" + c_tzls="$c_tzls ) engine=MyISAM DEFAULT CHARACTER SET latin1" c_tzls="$c_tzls comment='Leap seconds information for time zones';" if test "$1" = "test" From 9700398e8b7dea9413c6cc9da7ffca2401599e56 Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Fri, 3 Sep 2004 19:56:24 +0400 Subject: [PATCH 42/52] Fix for bug #4373: \u behaves differently --- client/mysql.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index bca89b33b4f..0b43f9b80ec 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2693,8 +2693,9 @@ char *get_arg(char *line, my_bool get_next_arg) ptr++; if (*ptr == '\\') // short command was used ptr+= 2; - while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command - ptr++; + else + while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command + ptr++; } if (!*ptr) return NullS; From 38f462ae6f8ae71157520b27abf3f7abc6858eff Mon Sep 17 00:00:00 2001 From: "paul@kite-hub.kitebird.com" <> Date: Fri, 3 Sep 2004 10:56:55 -0500 Subject: [PATCH 43/52] sql_yacc.yy: Allow FROM or IN in SHOW KEYS, as in other SHOW statements. --- sql/sql_yacc.yy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2199a0c8be5..6b073db2e36 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2917,7 +2917,7 @@ show_param: lex->select->select_limit= lex->thd->variables.select_limit; lex->select->offset_limit= 0L; } limit_clause - | keys_or_index FROM table_ident opt_db + | keys_or_index from_or_in table_ident opt_db { Lex->sql_command= SQLCOM_SHOW_KEYS; if ($4) From c3cb5980c286eccb00ae088dfd3de4aaa29e239f Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Sat, 4 Sep 2004 00:28:48 +0500 Subject: [PATCH 44/52] define macro "DEFINE_ALL_CHARACTER_SETS" in the configure.in completely --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 8772280cd4b..788848ba4c2 100644 --- a/configure.in +++ b/configure.in @@ -2445,10 +2445,10 @@ elif test "$extra_charsets" = none; then CHARSETS="$CHARSETS" elif test "$extra_charsets" = complex; then CHARSETS="$CHARSETS $CHARSETS_COMPLEX" - AC_DEFINE([DEFINE_ALL_CHARACTER_SETS]) + AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available]) elif test "$extra_charsets" = all; then CHARSETS="$CHARSETS $CHARSETS_AVAILABLE" - AC_DEFINE([DEFINE_ALL_CHARACTER_SETS]) + AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available]) else EXTRA_CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'` CHARSETS="$CHARSETS $EXTRA_CHARSETS" From bdec2c603b0f15acef0d06ab34b160f4405b81db Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 3 Sep 2004 23:28:49 +0400 Subject: [PATCH 45/52] A fix for bug#4368 '"like" fails in PreparedStatement, crashes server': the bug occurs when arguments of LIKE function are in differentcharacter sets. If these character sets are compatible, we create an item-converter. In prepared mode, this item needs to be created in memory of current prepared statement. --- mysql-test/r/ps.result | 11 +++++++++++ mysql-test/t/ps.test | 17 +++++++++++++++++ sql/item_cmpfunc.cc | 15 +++++++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index e161904cd6f..321b8894796 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -259,3 +259,14 @@ execute ` 1234 1234 set names default; +create table t1 (a varchar(10)) charset=utf8; +insert into t1 (a) values ('yahoo'); +set character_set_connection=latin1; +prepare stmt from 'select a from t1 where a like ?'; +set @var='google'; +execute stmt using @var; +a +execute stmt using @var; +a +deallocate prepare stmt; +drop table t1; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index e54bf8076e0..cbc76e02b42 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -261,3 +261,20 @@ execute ` set names default; +# +# BUG#4368 "select * from t1 where a like ?" crashes server if a is in utf8 +# and ? is in latin1 +# Check that Item converting latin1 to utf8 (for LIKE function) is created +# in memory of prepared statement. +# + +create table t1 (a varchar(10)) charset=utf8; +insert into t1 (a) values ('yahoo'); +set character_set_connection=latin1; +prepare stmt from 'select a from t1 where a like ?'; +set @var='google'; +execute stmt using @var; +execute stmt using @var; +deallocate prepare stmt; +drop table t1; + diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f473d242b07..85b22d1eddd 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -211,9 +211,20 @@ void Item_bool_func2::fix_length_and_dec() } else { - conv= new Item_func_conv_charset(args[weak],args[strong]->collation.collation); + THD *thd= current_thd; + /* + In case we're in statement prepare, create conversion item + in its memory: it will be reused on each execute. + */ + Item_arena *arena= thd->current_arena, backup; + if (arena->is_stmt_prepare()) + thd->set_n_backup_item_arena(arena, &backup); + conv= new Item_func_conv_charset(args[weak], + args[strong]->collation.collation); + if (arena->is_stmt_prepare()) + thd->restore_backup_item_arena(arena, &backup); conv->collation.set(args[weak]->collation.derivation); - conv->fix_fields(current_thd, 0, &conv); + conv->fix_fields(thd, 0, &conv); } args[weak]= conv ? conv : args[weak]; } From 9b0468bc96e10ddf28b3541e8a64d7472620f0fa Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 3 Sep 2004 22:04:08 +0200 Subject: [PATCH 46/52] BUG#5327 - mi_sort_index() of 2-level tree --- myisam/mi_check.c | 32 +++++++++++++++++++++++--------- mysql-test/r/fulltext2.result | 9 +++++++++ mysql-test/t/fulltext2.test | 8 ++++++++ 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/myisam/mi_check.c b/myisam/mi_check.c index a1c3698b3e9..1f6089d0a3c 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1585,7 +1585,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) int old_lock; MYISAM_SHARE *share=info->s; MI_STATE_INFO old_state; - DBUG_ENTER("sort_index"); + DBUG_ENTER("mi_sort_index"); if (!(param->testflag & T_SILENT)) printf("- Sorting index for MyISAM-table '%s'\n",name); @@ -1664,7 +1664,7 @@ err: err2: VOID(my_delete(param->temp_filename,MYF(MY_WME))); DBUG_RETURN(-1); -} /* sort_index */ +} /* mi_sort_index */ /* Sort records recursive using one index */ @@ -1672,7 +1672,7 @@ err2: static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pagepos, File new_file) { - uint length,nod_flag,used_length; + uint length,nod_flag,used_length, key_length; uchar *buff,*keypos,*endpos; uchar key[MI_MAX_POSSIBLE_KEY_BUFF]; my_off_t new_page_pos,next_page; @@ -1693,7 +1693,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, llstr(pagepos,llbuff)); goto err; } - if ((nod_flag=mi_test_if_nod(buff))) + if ((nod_flag=mi_test_if_nod(buff)) || keyinfo->flag & HA_FULLTEXT) { used_length=mi_getint(buff); keypos=buff+2+nod_flag; @@ -1704,7 +1704,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, { next_page=_mi_kpos(nod_flag,keypos); _mi_kpointer(info,keypos-nod_flag,param->new_file_pos); /* Save new pos */ - if (sort_one_index(param,info,keyinfo,next_page, new_file)) + if (sort_one_index(param,info,keyinfo,next_page,new_file)) { DBUG_PRINT("error",("From page: %ld, keyoffset: %d used_length: %d", (ulong) pagepos, (int) (keypos - buff), @@ -1714,11 +1714,25 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, } } if (keypos >= endpos || - ((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0) + (key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0) break; -#ifdef EXTRA_DEBUG - assert(keypos <= endpos); -#endif + DBUG_ASSERT(keypos <= endpos); + if (keyinfo->flag & HA_FULLTEXT) + { + uint off; + int subkeys; + get_key_full_length_rdonly(off, key); + subkeys=ft_sintXkorr(key+off); + if (subkeys < 0) + { + next_page= _mi_dpos(info,0,key+key_length); + _mi_dpointer(info,keypos-nod_flag-info->s->rec_reflength, + param->new_file_pos); /* Save new pos */ + if (sort_one_index(param,info,&info->s->ft2_keyinfo, + next_page,new_file)) + goto err; + } + } } } diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index 0fdb7d4dbd1..0b1d8eb9a15 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -7,6 +7,15 @@ FULLTEXT KEY (a) repair table t1 quick; Table Op Msg_type Msg_text test.t1 repair status OK +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK select count(*) from t1 where match a against ('aaaxxx'); count(*) 260 diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index cab1d096fe7..1d3a5307412 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -44,6 +44,9 @@ while ($1) # converting to two-level repair table t1 quick; +check table t1; +optimize table t1; # BUG#5327 - mi_sort_index() of 2-level tree +check table t1; select count(*) from t1 where match a against ('aaaxxx'); select count(*) from t1 where match a against ('aaayyy'); @@ -102,6 +105,11 @@ CREATE TABLE t1 ( FULLTEXT KEY (a) ) ENGINE=MyISAM; +# +# now same as about but w/o repair table +# 2-level tree created by mi_write +# + # two-level entry, second-level tree with depth 2 --disable_query_log let $1=260; From 040fcb2d1e29c6a20bf4a6e86f8493227014b2ec Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Fri, 3 Sep 2004 22:20:03 +0200 Subject: [PATCH 47/52] Fixed initialization of trans id --- ndb/src/ndbapi/Ndbif.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp index 3e98640b9fb..4560ed09b6a 100644 --- a/ndb/src/ndbapi/Ndbif.cpp +++ b/ndb/src/ndbapi/Ndbif.cpp @@ -87,7 +87,7 @@ Ndb::init(int aMaxNoOfTransactions) }//if theNdbBlockNumber = tBlockNo; - + theFacade->unlock_mutex(); theDictionary->setTransporter(this, theFacade); @@ -185,10 +185,12 @@ Ndb::executeMessage(void* NdbObject, void Ndb::connected(Uint32 ref) { theMyRef= ref; - theNode= refToNode(theMyRef); - if (theNdbBlockNumber >= 0) + theNode= refToNode(ref); + Uint64 tBlockNo= refToBlock(ref); + if (theNdbBlockNumber >= 0){ assert(theMyRef == numberToRef(theNdbBlockNumber, theNode)); - + } + TransporterFacade * theFacade = TransporterFacade::instance(); int i; theNoOfDBnodes= 0; @@ -198,11 +200,11 @@ void Ndb::connected(Uint32 ref) theNoOfDBnodes++; } } - theFirstTransId = ((Uint64)theNdbBlockNumber << 52)+ + theFirstTransId = ((Uint64)tBlockNo << 52)+ ((Uint64)theNode << 40); theFirstTransId += theFacade->m_max_trans_id; // assert(0); - DBUG_PRINT("info",("connected with ref=%x, id=%d, no_db_nodes=%d, first_trans_id=%d", + DBUG_PRINT("info",("connected with ref=%x, id=%d, no_db_nodes=%d, first_trans_id=%lx", theMyRef, theNode, theNoOfDBnodes, From 5d71817c7049e9db5c22e1667a41f57cf558d8ed Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Sun, 5 Sep 2004 02:31:11 +0300 Subject: [PATCH 48/52] After merge fixes --- mysql-test/r/merge.result | 4 ++-- mysql-test/r/union.result | 8 ++++---- mysql-test/t/union.test | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 2f4f0071fa7..5755033190b 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -647,7 +647,7 @@ create table t2 (a int); insert into t1 values (0); insert into t2 values (1); create table t3 engine=merge union=(t1, t2) select * from t1; -INSERT TABLE 't1' isn't allowed in FROM table list +ERROR HY000: You can't specify target table 't1' for update in FROM clause create table t3 engine=merge union=(t1, t2) select * from t2; -INSERT TABLE 't2' isn't allowed in FROM table list +ERROR HY000: You can't specify target table 't2' for update in FROM clause drop table t1, t2; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 2062d332f5d..2f42bedf67a 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -431,7 +431,6 @@ create table t1 select a from t1 union select a from t2; ERROR HY000: You can't specify target table 't1' for update in FROM clause select a from t1 union select a from t2 order by t2.a; ERROR 42S02: Unknown table 't2' in order clause -drop table t1; drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; * @@ -440,9 +439,10 @@ select length(version()) > 1 as `*` UNION select 2; create table t1 (a int); insert into t1 values (0), (3), (1), (2); explain (select * from t1) union (select * from t1) order by a; -table type possible_keys key key_len ref rows Extra -t1 ALL NULL NULL NULL NULL 4 -t1 ALL NULL NULL NULL NULL 4 +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 +2 UNION t1 ALL NULL NULL NULL NULL 4 +NULL UNION RESULT ALL NULL NULL NULL NULL NULL Using filesort drop table t1; CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES("1"); diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 9248305a750..263f631a65f 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -256,7 +256,6 @@ drop temporary table t1; create table t1 select a from t1 union select a from t2; --error 1109 select a from t1 union select a from t2 order by t2.a; -drop table t1; # Drop temporary table drop table t1,t2; # From ad6ad34b45ed8414eec08885334d540eafafb0fc Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Sun, 5 Sep 2004 10:57:26 +0300 Subject: [PATCH 49/52] memory leak fixed --- sql/sql_derived.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 30b06e91082..05ad2094372 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -222,10 +222,12 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, table->next= thd->derived_tables; thd->derived_tables= table; } + } + else + free_tmp_table(thd, table); exit: - delete derived_result; - lex->current_select= save_current_select; - } + delete derived_result; + lex->current_select= save_current_select; DBUG_RETURN(res); } From 02fbe60cec1d19584558f03d1ce5339b02201291 Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Mon, 6 Sep 2004 07:08:40 +0200 Subject: [PATCH 50/52] Added testReadPerf that compares different access methods - pk read (batch and serial) - unique index read (batch and serial) - eq-bound ordered index - range ordered index - sorted range ordered index - interpretered scan --- ndb/test/ndbapi/Makefile.am | 3 +- ndb/test/ndbapi/testReadPerf.cpp | 410 +++++++++++++++++++++++++++++++ ndb/test/ndbapi/testScanPerf.cpp | 26 +- 3 files changed, 415 insertions(+), 24 deletions(-) create mode 100644 ndb/test/ndbapi/testReadPerf.cpp diff --git a/ndb/test/ndbapi/Makefile.am b/ndb/test/ndbapi/Makefile.am index 19b8235acd5..95fcf621e89 100644 --- a/ndb/test/ndbapi/Makefile.am +++ b/ndb/test/ndbapi/Makefile.am @@ -30,7 +30,7 @@ testSystemRestart \ testTimeout \ testTransactions \ testDeadlock \ -test_event ndbapi_slow_select +test_event ndbapi_slow_select testReadPerf #flexTimedAsynch #testBlobs @@ -67,6 +67,7 @@ testTransactions_SOURCES = testTransactions.cpp testDeadlock_SOURCES = testDeadlock.cpp test_event_SOURCES = test_event.cpp ndbapi_slow_select_SOURCES = slow_select.cpp +testReadPerf_SOURCES = testReadPerf.cpp INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel diff --git a/ndb/test/ndbapi/testReadPerf.cpp b/ndb/test/ndbapi/testReadPerf.cpp new file mode 100644 index 00000000000..88c21944864 --- /dev/null +++ b/ndb/test/ndbapi/testReadPerf.cpp @@ -0,0 +1,410 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include +#include +#include + +struct Parameter { + const char * name; + unsigned value; + unsigned min; + unsigned max; +}; + +#define P_OPER 0 +#define P_RANGE 1 +#define P_ROWS 2 +#define P_LOOPS 3 +#define P_CREATE 4 +#define P_LOAD 5 + +#define P_MAX 6 + +/** + * operation + * 0 - serial pk + * 1 - batch pk + * 2 - serial uniq + * 3 - batch uniq + * 4 - index eq + * 5 - range scan + * 6 - ordered range scan + * 7 - interpreted scan + */ +static const char * g_ops[] = { + "serial pk", + "batch pk", + "serial uniq index access", + "batch uniq index access", + "index eq-bound", + "index range", + "index ordered", + "interpreted scan" +}; + +#define P_OP_TYPES 8 +static Uint64 g_times[P_OP_TYPES]; + +static +Parameter +g_paramters[] = { + { "operation", 0, 0, 6 }, // 0 + { "range", 1000, 1, ~0 },// 1 no of rows to read + { "size", 1000000, 1, ~0 },// 2 rows in tables + { "iterations", 3, 1, ~0 },// 3 + { "create_drop", 0, 0, 1 }, // 4 + { "data", 0, 0, 1 } // 5 +}; + +static Ndb* g_ndb = 0; +static const NdbDictionary::Table * g_tab; +static const NdbDictionary::Index * g_i_unique; +static const NdbDictionary::Index * g_i_ordered; +static char g_table[256]; +static char g_unique[256]; +static char g_ordered[256]; +static char g_buffer[2*1024*1024]; + +int create_table(); +int load_table(); +int run_read(); +int clear_table(); +int drop_table(); +void print_result(); + +int +main(int argc, const char** argv){ + int verbose = 1; + int optind = 0; + + struct getargs args[1+P_MAX] = { + { "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" } + }; + const int num_args = 1 + P_MAX; + for(int i = 0; iinit() != 0){ + g_err << "init() failed" << endl; + goto error; + } + if(g_ndb->waitUntilReady() != 0){ + g_err << "Wait until ready failed" << endl; + goto error; + } + for(int i = optind; igetDictionary(); + assert(dict); + if(g_paramters[P_CREATE].value){ + const NdbDictionary::Table * pTab = NDBT_Tables::getTable(g_table); + assert(pTab); + NdbDictionary::Table copy = * pTab; + copy.setLogging(false); + if(dict->createTable(copy) != 0){ + g_err << "Failed to create table: " << g_table << endl; + return -1; + } + + NdbDictionary::Index x(g_ordered); + x.setTable(g_table); + x.setType(NdbDictionary::Index::OrderedIndex); + x.setLogging(false); + for (unsigned k = 0; k < copy.getNoOfColumns(); k++){ + if(copy.getColumn(k)->getPrimaryKey()){ + x.addColumn(copy.getColumn(k)->getName()); + } + } + + if(dict->createIndex(x) != 0){ + g_err << "Failed to create index: " << endl; + return -1; + } + + x.setName(g_unique); + x.setType(NdbDictionary::Index::UniqueHashIndex); + if(dict->createIndex(x) != 0){ + g_err << "Failed to create index: " << endl; + return -1; + } + } + g_tab = dict->getTable(g_table); + g_i_unique = dict->getIndex(g_unique, g_table); + g_i_ordered = dict->getIndex(g_ordered, g_table); + assert(g_tab); + assert(g_i_unique); + assert(g_i_ordered); + return 0; +} + +int +drop_table(){ + if(!g_paramters[P_CREATE].value) + return 0; + if(g_ndb->getDictionary()->dropTable(g_tab->getName()) != 0){ + g_err << "Failed to drop table: " << g_tab->getName() << endl; + return -1; + } + g_tab = 0; + return 0; +} + +int +load_table(){ + if(!g_paramters[P_LOAD].value) + return 0; + + int rows = g_paramters[P_ROWS].value; + HugoTransactions hugoTrans(* g_tab); + if (hugoTrans.loadTable(g_ndb, rows)){ + g_err.println("Failed to load %s with %d rows", g_tab->getName(), rows); + return -1; + } + return 0; +} + +int +clear_table(){ + if(!g_paramters[P_LOAD].value) + return 0; + int rows = g_paramters[P_ROWS].value; + + UtilTransactions utilTrans(* g_tab); + if (utilTrans.clearTable(g_ndb, rows) != 0){ + g_err.println("Failed to clear table %s", g_tab->getName()); + return -1; + } + return 0; +} + +inline +void err(NdbError e){ + ndbout << e << endl; +} + +static +void +do_work(){ + int sz = 10 * 1024; + int pos= rand() % (sizeof(g_buffer) - sz); + memset(g_buffer+pos, rand(), sz); +} + +int +run_read(){ + int iter = g_paramters[P_LOOPS].value; + NDB_TICKS start1, stop; + int sum_time= 0; + + const Uint32 rows = g_paramters[P_ROWS].value; + const Uint32 range = g_paramters[P_RANGE].value; + + start1 = NdbTick_CurrentMillisecond(); + NdbConnection * pTrans = g_ndb->startTransaction(); + if(!pTrans){ + g_err << "Failed to start transaction" << endl; + err(g_ndb->getNdbError()); + return -1; + } + + NdbOperation * pOp; + NdbScanOperation * pSp; + NdbIndexOperation * pUp; + NdbIndexScanOperation * pIp; + NdbResultSet * rs = (NdbResultSet*)~0; + + Uint32 start_row = rand() % (rows - range); + Uint32 stop_row = start_row + range; + + /** + * 0 - serial pk + * 1 - batch pk + * 2 - serial uniq + * 3 - batch uniq + * 4 - index eq + * 5 - range scan + * 6 - interpreted scan + */ + int check = 0; + void* res = (void*)~0; + const Uint32 pk = 0; + Uint32 cnt = 0; + for(; start_row < stop_row; start_row++){ + switch(g_paramters[P_OPER].value){ + case 0: + pOp = pTrans->getNdbOperation(g_table); + check = pOp->readTuple(); + check = pOp->equal(pk, start_row); + break; + case 1: + for(; start_rowgetNdbOperation(g_table); + check = pOp->readTuple(); + check = pOp->equal(pk, start_row); + for(int j = 0; jgetNoOfColumns(); j++){ + res = pOp->getValue(j); + assert(res); + } + } + break; + case 2: + pOp = pTrans->getNdbIndexOperation(g_unique, g_table); + check = pOp->readTuple(); + check = pOp->equal(pk, start_row); + break; + case 3: + for(; start_rowgetNdbIndexOperation(g_unique, g_table); + check = pOp->readTuple(); + check = pOp->equal(pk, start_row); + for(int j = 0; jgetNoOfColumns(); j++){ + res = pOp->getValue(j); + assert(res); + } + } + break; + case 4: + pOp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table); + rs = pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0); + check = pIp->setBound(pk, NdbIndexScanOperation::BoundEQ, &start_row); + break; + case 5: + pOp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table); + rs = pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0); + check = pIp->setBound(pk, NdbIndexScanOperation::BoundLE, &start_row); + check = pIp->setBound(pk, NdbIndexScanOperation::BoundGT, &stop_row); + start_row = stop_row; + break; + case 6: + pOp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table); + rs = pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0, true); + check = pIp->setBound(pk, NdbIndexScanOperation::BoundLE, &start_row); + check = pIp->setBound(pk, NdbIndexScanOperation::BoundGT, &stop_row); + start_row = stop_row; + break; + case 7: + pOp = pSp = pTrans->getNdbScanOperation(g_table); + rs = pSp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0); + NdbScanFilter filter(pOp) ; + filter.begin(NdbScanFilter::AND); + filter.ge(pk, start_row); + filter.lt(pk, stop_row); + filter.end(); + start_row = stop_row; + break; + } + + assert(res); + if(check != 0){ + ndbout << pOp->getNdbError() << endl; + ndbout << pTrans->getNdbError() << endl; + } + assert(check == 0); + assert(rs); + + for(int j = 0; jgetNoOfColumns(); j++){ + res = pOp->getValue(j); + assert(res); + } + + check = pTrans->execute(NoCommit); + if(check != 0){ + ndbout << pTrans->getNdbError() << endl; + } + assert(check == 0); + if(g_paramters[P_OPER].value >= 4){ + while((check = rs->nextResult(true)) == 0){ + do_work(); + cnt++; + } + + if(check == -1){ + err(pTrans->getNdbError()); + return -1; + } + assert(check == 1); + rs->close(); + } else { + if(start_row != stop_row) + do_work(); + else + for(int j = 0; jclose(); + + stop = NdbTick_CurrentMillisecond(); + g_times[g_paramters[P_OPER].value] += (stop - start1); + return 0; +} + +void +print_result(){ + for(int i = 0; igetNdbScanOperation(g_tablename); assert(pOp); -#ifdef NdbIndexScanOperation_H rs = pOp->readTuples(lm, bat, par); -#else - int oldp = (par == 0 ? 240 : par) * (bat == 0 ? 15 : bat); - rs = pOp->readTuples(oldp > 240 ? 240 : oldp, lm); -#endif } else { -#ifdef NdbIndexScanOperation_H pOp = pIOp = pTrans->getNdbIndexScanOperation(g_indexname, g_tablename); bool ord = g_paramters[P_ACCESS].value == 2; rs = pIOp->readTuples(lm, bat, par, ord); -#else - pOp = pIOp = pTrans->getNdbScanOperation(g_indexname, g_tablename); - assert(pOp); - int oldp = (par == 0 ? 240 : par) * (bat == 0 ? 15 : bat); - rs = pIOp->readTuples(oldp > 240 ? 240 : oldp, lm); -#endif switch(g_paramters[P_BOUND].value){ case 0: // All break; case 1: // None -#ifdef NdbIndexScanOperation_H pIOp->setBound((Uint32)0, NdbIndexScanOperation::BoundEQ, 0); -#else - pIOp->setBound((Uint32)0, NdbOperation::BoundEQ, 0); -#endif break; case 2: { // 1 row default: From b484ed6168a2fbab9851e13839e6ddc4203f14e7 Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Mon, 6 Sep 2004 10:05:55 +0200 Subject: [PATCH 51/52] merge --- mysql-test/r/ndb_blob.result | 6 +++--- mysql-test/t/ndb_blob.test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result index 4244c05e446..45b003e6967 100644 --- a/mysql-test/r/ndb_blob.result +++ b/mysql-test/r/ndb_blob.result @@ -1,5 +1,5 @@ drop table if exists t1; -drop database if exists test2; +drop database if exists mysqltest; create table t1 ( a int not null primary key, b tinytext @@ -276,8 +276,8 @@ a b c d 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 -create database test2; -use test2; +create database mysqltest; +use mysqltest; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test index 0df13eefe10..e5a9f7446d4 100644 --- a/mysql-test/t/ndb_blob.test +++ b/mysql-test/t/ndb_blob.test @@ -118,7 +118,7 @@ from t1 where a=2; update t1 set d=null where a=1; commit; # FIXME now fails at random due to weird mixup between the 2 rows -#select a from t1 where d is null; +select a from t1 where d is null; # pk delete delete from t1 where a=1; From c20c8baf2e3cc8c64a3e05a8ef1c72711a8015b0 Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Mon, 6 Sep 2004 10:13:54 +0200 Subject: [PATCH 52/52] removed faked do_work --- ndb/test/ndbapi/testReadPerf.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/ndb/test/ndbapi/testReadPerf.cpp b/ndb/test/ndbapi/testReadPerf.cpp index 88c21944864..ea39e92558a 100644 --- a/ndb/test/ndbapi/testReadPerf.cpp +++ b/ndb/test/ndbapi/testReadPerf.cpp @@ -242,14 +242,6 @@ void err(NdbError e){ ndbout << e << endl; } -static -void -do_work(){ - int sz = 10 * 1024; - int pos= rand() % (sizeof(g_buffer) - sz); - memset(g_buffer+pos, rand(), sz); -} - int run_read(){ int iter = g_paramters[P_LOOPS].value; @@ -374,7 +366,6 @@ run_read(){ assert(check == 0); if(g_paramters[P_OPER].value >= 4){ while((check = rs->nextResult(true)) == 0){ - do_work(); cnt++; } @@ -384,12 +375,6 @@ run_read(){ } assert(check == 1); rs->close(); - } else { - if(start_row != stop_row) - do_work(); - else - for(int j = 0; j