summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok7
-rwxr-xr-xBuild-tools/Do-compile269
-rwxr-xr-xBuild-tools/mysql-copyright4
-rw-r--r--Docs/manual.texi1924
-rw-r--r--VC++Files/bdb/bdb.dsp33
-rw-r--r--VC++Files/bdb/build_win32/db_static1.dsp85
-rw-r--r--VC++Files/bdb/build_win32/libdb.def151
-rw-r--r--VC++Files/bdb/build_win32/libdb_tcl.def35
-rw-r--r--VC++Files/client/mysql.dsp7
-rw-r--r--VC++Files/client/mysqladmin.dsp3
-rw-r--r--VC++Files/client/mysqlclient.dsp8
-rw-r--r--VC++Files/client/mysqldump.dsp5
-rw-r--r--VC++Files/client/mysqlimport.dsp5
-rw-r--r--VC++Files/client/mysqlshow.dsp5
-rw-r--r--VC++Files/innobase/innobase.dsp68
-rw-r--r--VC++Files/libmysql/libmysql.def118
-rw-r--r--VC++Files/libmysql/libmysql.dsp (renamed from VC++Files/libmysql/libmySQL.dsp)13
-rw-r--r--VC++Files/libmysqld/libmysqld.def65
-rw-r--r--VC++Files/libmysqld/libmysqld.dsp20
-rw-r--r--VC++Files/libmysqltest/myTest.dsp3
-rw-r--r--VC++Files/libmysqltest/mytest.c2
-rw-r--r--VC++Files/mysql.dsw86
-rw-r--r--VC++Files/mysqlbinlog/mysqlbinlog.dsp6
-rw-r--r--VC++Files/mysqlcheck/mysqlcheck.dsp8
-rw-r--r--VC++Files/mysqlmanager/MySqlManager.dsp3
-rw-r--r--VC++Files/mysys/mysys.dsp30
-rw-r--r--VC++Files/pack_isam/pack_isam.dsp3
-rw-r--r--VC++Files/perror/perror.dsp6
-rw-r--r--VC++Files/replace/replace.dsp3
-rw-r--r--VC++Files/sql/mysqld.dsp47
-rw-r--r--VC++Files/test1/test1.dsp3
-rw-r--r--VC++Files/thr_insert_test/thr_insert_test.dsp4
-rw-r--r--VC++Files/thr_test/thr_test.dsp3
-rw-r--r--VC++Files/vio/vio.dsp2
-rw-r--r--acinclude.m414
-rw-r--r--client/Makefile.am4
-rw-r--r--client/mysql.cc22
-rw-r--r--client/mysqladmin.c8
-rw-r--r--client/mysqlbinlog.cc41
-rw-r--r--client/mysqlcheck.c22
-rw-r--r--client/mysqldump.c34
-rw-r--r--client/mysqlimport.c8
-rw-r--r--client/mysqlshow.c14
-rw-r--r--client/mysqltest.c130
-rw-r--r--configure.in50
-rw-r--r--include/Makefile.am8
-rw-r--r--include/config-win.h2
-rw-r--r--include/my_base.h1
-rw-r--r--include/my_global.h2
-rw-r--r--include/my_sys.h21
-rw-r--r--include/sslopt-case.h (renamed from include/sslopt-usage.h)18
-rw-r--r--include/sslopt-longopts.h4
-rw-r--r--include/violite.h11
-rw-r--r--innobase/btr/btr0btr.c19
-rw-r--r--innobase/btr/btr0cur.c27
-rw-r--r--innobase/configure.in2
-rw-r--r--innobase/dict/dict0dict.c53
-rw-r--r--innobase/dict/dict0mem.c2
-rw-r--r--innobase/include/dict0dict.h13
-rw-r--r--innobase/include/dict0mem.h7
-rw-r--r--innobase/include/row0sel.h12
-rw-r--r--innobase/include/srv0srv.h2
-rw-r--r--innobase/include/trx0trx.h8
-rw-r--r--innobase/include/trx0trx.ic19
-rw-r--r--innobase/lock/lock0lock.c20
-rw-r--r--innobase/os/os0file.c79
-rw-r--r--innobase/os/os0sync.c6
-rw-r--r--innobase/os/os0thread.c20
-rw-r--r--innobase/row/row0ins.c39
-rw-r--r--innobase/row/row0mysql.c16
-rw-r--r--innobase/row/row0sel.c54
-rw-r--r--innobase/srv/srv0srv.c15
-rw-r--r--innobase/sync/sync0arr.c2
-rw-r--r--innobase/trx/trx0undo.c7
-rw-r--r--libmysql/libmysql.c47
-rw-r--r--libmysql/libmysql.def5
-rw-r--r--libmysqld/examples/Makefile.am4
-rw-r--r--libmysqld/lib_load.cc44
-rw-r--r--libmysqld/lib_sql.cc1
-rw-r--r--myisam/ft_boolean_search.c22
-rw-r--r--myisam/mi_check.c10
-rw-r--r--myisam/mi_create.c3
-rw-r--r--myisam/mi_extra.c12
-rw-r--r--myisam/myisamchk.c5
-rw-r--r--mysql-test/install_test_db.sh10
-rw-r--r--mysql-test/mysql-test-run.sh31
-rw-r--r--mysql-test/r/bdb-alter-table-1.result11
-rw-r--r--mysql-test/r/bdb-alter-table-2.result6
-rw-r--r--mysql-test/r/binary.result11
-rw-r--r--mysql-test/r/create.result5
-rw-r--r--mysql-test/r/delayed.result1
-rw-r--r--mysql-test/r/distinct.result22
-rw-r--r--mysql-test/r/fulltext_left_join.result1
-rw-r--r--mysql-test/r/fulltext_order_by.result15
-rw-r--r--mysql-test/r/func_group.result1
-rw-r--r--mysql-test/r/func_in.result1
-rw-r--r--mysql-test/r/func_str.result5
-rw-r--r--mysql-test/r/grant.result60
-rw-r--r--mysql-test/r/handler.result2
-rw-r--r--mysql-test/r/innodb.result4
-rw-r--r--mysql-test/r/innodb_handler.result2
-rw-r--r--mysql-test/r/insert.result8
-rw-r--r--mysql-test/r/key_primary.result1
-rw-r--r--mysql-test/r/lock_multi.result1
-rw-r--r--mysql-test/r/lowercase_table.result15
-rw-r--r--mysql-test/r/myisam.result14
-rw-r--r--mysql-test/r/odbc.result1
-rw-r--r--mysql-test/r/order_by.result35
-rw-r--r--mysql-test/r/repair.result7
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result17
-rw-r--r--mysql-test/r/rpl_log.result41
-rw-r--r--mysql-test/r/rpl_magic.result37
-rw-r--r--mysql-test/r/rpl_redirect.result43
-rw-r--r--mysql-test/r/rpl_rotate_logs.result8
-rw-r--r--mysql-test/r/select.result20
-rw-r--r--mysql-test/r/truncate.result1
-rw-r--r--mysql-test/r/type_set.result1
-rw-r--r--mysql-test/r/type_time.result1
-rw-r--r--mysql-test/r/type_timestamp.result1
-rw-r--r--mysql-test/r/type_year.result1
-rw-r--r--mysql-test/r/varbinary.result3
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--mysql-test/r/warnings.result1
-rw-r--r--mysql-test/t/bdb-alter-table-1.test13
-rw-r--r--mysql-test/t/bdb-alter-table-2-master.opt2
-rw-r--r--mysql-test/t/bdb-alter-table-2.test8
-rw-r--r--mysql-test/t/binary.test11
-rw-r--r--mysql-test/t/create.test3
-rw-r--r--mysql-test/t/delayed.test1
-rw-r--r--mysql-test/t/distinct.test26
-rw-r--r--mysql-test/t/flush_table.test1
-rw-r--r--mysql-test/t/fulltext_left_join.test1
-rw-r--r--mysql-test/t/fulltext_order_by.test14
-rw-r--r--mysql-test/t/func_group.test1
-rw-r--r--mysql-test/t/func_in.test1
-rw-r--r--mysql-test/t/func_str.test9
-rw-r--r--mysql-test/t/grant.test41
-rw-r--r--mysql-test/t/insert.test9
-rw-r--r--mysql-test/t/key_primary.test1
-rw-r--r--mysql-test/t/lock_multi.test1
-rw-r--r--mysql-test/t/lowercase_table-master.opt1
-rw-r--r--mysql-test/t/lowercase_table.test14
-rw-r--r--mysql-test/t/myisam.test21
-rw-r--r--mysql-test/t/odbc.test1
-rw-r--r--mysql-test/t/order_by.test38
-rw-r--r--mysql-test/t/repair.test8
-rw-r--r--mysql-test/t/rpl_flush_log_loop-master.opt1
-rwxr-xr-xmysql-test/t/rpl_flush_log_loop-master.sh5
-rw-r--r--mysql-test/t/rpl_flush_log_loop-slave.opt1
-rwxr-xr-xmysql-test/t/rpl_flush_log_loop-slave.sh4
-rw-r--r--mysql-test/t/rpl_flush_log_loop.test20
-rw-r--r--mysql-test/t/rpl_log.test40
-rw-r--r--mysql-test/t/rpl_mystery22.test2
-rw-r--r--mysql-test/t/rpl_redirect.test (renamed from mysql-test/t/rpl_magic.test)13
-rw-r--r--mysql-test/t/rpl_rotate_logs.test9
-rw-r--r--mysql-test/t/select.test16
-rw-r--r--mysql-test/t/truncate.test1
-rw-r--r--mysql-test/t/type_set.test1
-rw-r--r--mysql-test/t/type_time.test1
-rw-r--r--mysql-test/t/type_timestamp.test1
-rw-r--r--mysql-test/t/type_year.test2
-rw-r--r--mysql-test/t/varbinary.test1
-rw-r--r--mysql-test/t/warnings.test2
-rw-r--r--mysys/mf_fn_ext.c19
-rw-r--r--mysys/my_aes.c5
-rw-r--r--mysys/my_getopt.c14
-rw-r--r--mysys/my_malloc.c14
-rw-r--r--mysys/my_symlink.c4
-rw-r--r--mysys/queues.c6
-rw-r--r--mysys/safemalloc.c20
-rw-r--r--mysys/thr_alarm.c4
-rw-r--r--scripts/explain_log.sh383
-rw-r--r--scripts/make_binary_distribution.sh9
-rw-r--r--scripts/mysql_explain_log.sh2
-rw-r--r--scripts/mysql_fix_privilege_tables.sh17
-rw-r--r--scripts/mysql_install_db.sh8
-rw-r--r--sql/Makefile.am5
-rw-r--r--sql/filesort.cc15
-rw-r--r--sql/ha_heap.h5
-rw-r--r--sql/ha_innodb.cc342
-rw-r--r--sql/ha_innodb.h9
-rw-r--r--sql/ha_isam.cc4
-rw-r--r--sql/ha_isammrg.h4
-rw-r--r--sql/ha_myisam.cc27
-rw-r--r--sql/ha_myisammrg.cc23
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_func.cc14
-rw-r--r--sql/item_strfunc.cc46
-rw-r--r--sql/item_strfunc.h6
-rw-r--r--sql/lex.h1
-rw-r--r--sql/lock.cc46
-rw-r--r--sql/log.cc38
-rw-r--r--sql/log_event.cc79
-rw-r--r--sql/log_event.h7
-rw-r--r--sql/mysql_priv.h7
-rw-r--r--sql/mysqld.cc58
-rw-r--r--sql/net_pkg.cc8
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/opt_range.cc8
-rw-r--r--sql/repl_failsafe.cc22
-rw-r--r--sql/set_var.cc64
-rw-r--r--sql/set_var.h18
-rw-r--r--sql/share/english/errmsg.txt2
-rw-r--r--sql/slave.cc128
-rw-r--r--sql/slave.h1
-rw-r--r--sql/sql_acl.cc341
-rw-r--r--sql/sql_acl.h25
-rw-r--r--sql/sql_base.cc28
-rw-r--r--sql/sql_cache.cc47
-rw-r--r--sql/sql_cache.h13
-rw-r--r--sql/sql_class.cc55
-rw-r--r--sql/sql_class.h13
-rw-r--r--sql/sql_db.cc2
-rw-r--r--sql/sql_handler.cc20
-rw-r--r--sql/sql_insert.cc8
-rw-r--r--sql/sql_lex.cc5
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_load.cc3
-rw-r--r--sql/sql_parse.cc95
-rw-r--r--sql/sql_repl.cc13
-rw-r--r--sql/sql_repl.h3
-rw-r--r--sql/sql_select.cc18
-rw-r--r--sql/sql_show.cc10
-rw-r--r--sql/sql_table.cc73
-rw-r--r--sql/sql_udf.cc76
-rw-r--r--sql/sql_union.cc2
-rw-r--r--sql/sql_yacc.yy72
-rw-r--r--sql/table.h16
-rw-r--r--sql/time.cc19
-rw-r--r--sql/udf_example.cc47
-rw-r--r--sql/unireg.h2
-rw-r--r--support-files/mysql.spec.sh8
-rw-r--r--tests/grant.pl5
-rw-r--r--tests/grant.res79
-rw-r--r--vio/docs/COPYING.dbug29
-rw-r--r--vio/docs/COPYING.mysql193
-rw-r--r--vio/docs/CodingStyle8
-rw-r--r--vio/docs/README18
-rw-r--r--vio/viosocket.c2
-rw-r--r--vio/viossl.c105
-rw-r--r--vio/viosslfactories.c2
242 files changed, 4901 insertions, 2870 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 1e82492161d..31fb7d85fa7 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -16,6 +16,8 @@ bell@sanja.is.com.ua
davida@isil.mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
+heikki@rescue.
+heikki@work.mysql.com
jani@dsl-jkl1657.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
@@ -31,6 +33,7 @@ jorge@linux.jorge.mysql.com
kaj@work.mysql.com
lenz@kallisto.mysql.com
lenz@mysql.com
+miguel@hegel.br
miguel@hegel.local
miguel@light.local
monty@bitch.mysql.fi
@@ -39,6 +42,7 @@ monty@hundin.mysql.fi
monty@mashka.mysql.fi
monty@narttu.
monty@narttu.mysql.fi
+monty@rescue.
monty@tik.
monty@tik.mysql.fi
monty@tramp.mysql.fi
@@ -57,9 +61,11 @@ root@x3.internalnet
salle@geopard.(none)
salle@geopard.online.bg
sasha@mysql.sashanet.com
+serg@build.mysql2.com
serg@serg.mysql.com
serg@sergbook.mysql.com
sinisa@rhols221.adsl.netsonic.fi
+tfr@beta.frontier86.ee
tfr@indrek.tfr.cafe.ee
tfr@sarvik.tfr.cafe.ee
tim@bitch.mysql.fi
@@ -75,6 +81,7 @@ tonu@x153.internalnet
tonu@x3.internalnet
venu@myvenu.com
venu@work.mysql.com
+vva@genie.(none)
walrus@mysql.com
worm@altair.is.lan
zak@balfor.local
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 061b0c4147f..2e4da3091b0 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -1,15 +1,56 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
use Getopt::Long;
-$opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env="";
-$opt_dbd_options=$opt_perl_options=$opt_make_options=$opt_suffix="";
-$opt_tmp=$opt_version_suffix="";
-$opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0;
-$opt_innodb=$opt_bdb=0;
-GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","make-options=s", "sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s") || usage();
+@config_options= ();
+@make_options= ();
-usage() if ($opt_help || $opt_Information);
+$opt_distribution=$opt_user=$opt_config_env="";
+$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
+$opt_tmp=$opt_version_suffix="";
+$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0;
+$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0;
+
+GetOptions(
+ "bdb",
+ "build-thread=i",
+ "config-env=s",
+ "config-options=s" => \@config_options,
+ "dbd-options=s",
+ "debug",
+ "delete",
+ "distribution=s",
+ "enable-shared",
+ "fast-benchmark",
+ "help|Information",
+ "innodb",
+ "libwrap",
+ "local-perl",
+ "make-options=s" => \@make_options,
+ "no-crash-me",
+ "no-perl",
+ "no-strip",
+ "no-test|no-mysqltest",
+ "perl-files=s",
+ "perl-options=s",
+ "raid",
+ "stage=i",
+ "static-client",
+ "static-perl",
+ "static-server",
+ "suffix=s",
+ "sur",
+ "tcpip",
+ "tmp=s",
+ "use-old-distribution",
+ "user=s",
+ "version-suffix=s",
+ "with-low-memory",
+ "with-other-libc=s",
+ "with-small-disk",
+) || usage();
+
+usage() if ($opt_help);
usage() if (!$opt_distribution);
if ($opt_bdb && $opt_version_suffix eq "")
@@ -17,9 +58,20 @@ if ($opt_bdb && $opt_version_suffix eq "")
$opt_version_suffix="-max";
}
+if (@make_options > 0)
+{
+ chomp(@make_options);
+ $opt_make_options= join(" ", @make_options);
+}
+
+if (@config_options > 0)
+{
+ chomp(@config_options);
+ $opt_config_options= join(" ", @config_options);
+}
+
chomp($host=`hostname`);
$full_host_name=$host;
-info("Compiling MySQL$opt_version_suffix at $host$suffix, stage: $opt_stage\n");
$connect_option= ($opt_tcpip ? "--host=$host" : "");
$host =~ /^([^.-]*)/;
$host=$1 . $opt_suffix;
@@ -62,7 +114,6 @@ else
}
$bench_tmpdir="$opt_tmp/my_build-$host";
$ENV{'PATH'}= "$pwd/$host/bin:" . $ENV{'PATH'};
-$rsh=which("rcmd","rsh");
$make=which("gmake","make"); # Can't use -j here!
$tar=which("gtar","tar");
$sendmail=find("/usr/lib/sendmail","/usr/sbin/sendmail");
@@ -88,6 +139,8 @@ $|=1;
select STDOUT;
$|=1;
+info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n");
+
if (-x "$host/bin/mysqladmin")
{
log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown");
@@ -141,45 +194,45 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution)
}
safe_cd("$pwd/$host/$ver");
+
+#
+# Configure the sources
+#
if ($opt_stage <= 1)
{
- $opt_config_options.=" --with-low-memory" if ($opt_with_low_memory);
- # Fix files if this is in another timezone than work.mysql.com
+ # Fix files if this is in another timezone than the build host
unlink("config.cache");
unlink("bdb/build_unix/config.cache");
unlink("innobase/config.cache");
log_system("$make clean") if ($opt_use_old_distribution);
- if ($opt_static_server)
- {
- $opt_config_options.=" --with-mysqld-ldflags=-all-static";
- }
- if ($opt_static_client)
- {
- $opt_config_options.=" --with-client-ldflags=-all-static";
- }
+ $opt_config_options.= " --disable-shared" if (!$opt_enable_shared); # Default for binary versions
+ $opt_config_options.= " --with-berkeley-db" if ($opt_bdb);
+ $opt_config_options.= " --with-client-ldflags=-all-static" if ($opt_static_client);
+ $opt_config_options.= " --with-libwrap" if ($opt_libwrap);
+ $opt_config_options.= " --with-low-memory" if ($opt_with_low_memory);
+ $opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server);
+ $opt_config_options.= " --with-raid" if ($opt_raid);
+
+ # Only enable InnoDB when requested (required to be able to
+ # build the "Classic" packages that do not include InnoDB)
+ $opt_config_options.= " --without-innodb" if (!$opt_innodb);
+
if ($opt_with_other_libc)
{
- $opt_with_other_libc = "--with-other-libc=$opt_with_other_libc";
- }
- if (!$opt_enable_shared)
- {
- $opt_config_options.= " --disable-shared"; # Default for binary versions
- }
- if ($opt_bdb)
- {
- $opt_config_options.= " --with-berkeley-db"
+ $opt_with_other_libc= " --with-other-libc=$opt_with_other_libc";
+ $opt_config_options.= $opt_with_other_libc;
}
- if ($opt_innodb)
- {
- $opt_config_options.= " --with-innodb"
- }
- check_system("$opt_config_env ./configure --prefix=/usr/local/mysql \"--with-comment=Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex \"--with-server-suffix=$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
+
+ check_system("$opt_config_env ./configure --prefix=/usr/local/mysql --with-comment=\"Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex --with-server-suffix=\"$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
if (-d "$pwd/$host/include-mysql")
{
safe_system("cp -r $pwd/$host/include-mysql/* $pwd/$host/$ver/include");
}
}
+#
+# Compile the binaries
+#
if ($opt_stage <= 2)
{
my ($command);
@@ -190,16 +243,15 @@ if ($opt_stage <= 2)
}
#
-# Create a binary distrubtion
+# Create the binary distribution
#
if ($opt_stage <= 3)
{
- my ($flags);
+ my $flags= "";
log_system("rm -fr mysql-3* mysql-4* $pwd/$host/*.tar.gz");
log_system("nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz | cat");
- $flags="";
- $flags.="--no-strip" if ($opt_no_strip);
+ $flags.= "--no-strip" if ($opt_no_strip);
check_system("scripts/make_binary_distribution --tmp=$opt_tmp --suffix=$opt_suffix $flags",".tar.gz created");
safe_system("mv mysql*.tar.gz $pwd/$host");
if (-f "client/.libs/mysqladmin")
@@ -213,15 +265,15 @@ if ($opt_stage <= 3)
safe_system("$make clean") if ($opt_with_small_disk);
}
-#
-# Unpack and test the binary distrubtion
-#
-
$tar_file=<$pwd/$host/*.tar.gz>;
if (!defined($tar_file))
{
$tar_file=<$pwd/$host/*.tgz>;
}
+
+#
+# Unpack the binary distribution
+#
if ($opt_stage <= 4 && !$opt_no_test)
{
rm_all(<$pwd/$host/test/*>);
@@ -234,15 +286,19 @@ $ver=$1;
$test_dir="$pwd/$host/test/$ver";
$ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"};
-if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
+#
+# Run the test suite
+#
+if ($opt_stage <= 5 && !$opt_no_test)
{
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");
}
+#
# Start the server if we are going to run any of the benchmarks
-
+#
if (!$opt_no_test)
{
my $extra;
@@ -264,7 +320,9 @@ if (!$opt_no_test)
sleep(2);
}
-
+#
+# Compile and install the required Perl modules
+#
if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test)
{
safe_cd($test_dir);
@@ -297,7 +355,9 @@ if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test)
}
}
-
+#
+# Run crash-me test
+#
if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me)
{
safe_cd("$test_dir/sql-bench");
@@ -305,6 +365,9 @@ if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me)
safe_system("perl ./crash-me --force --batch-mode $connect_option");
}
+#
+# Run sql-bench Benchmarks
+#
if ($opt_stage <= 9 && !$opt_no_test)
{
safe_cd("$test_dir/sql-bench");
@@ -321,11 +384,6 @@ if ($opt_stage <= 9 && !$opt_no_test)
}
}
-if ($opt_stage <= 10 && $opt_result)
-{
- safe_system("rcp $pwd/$host/*.tar.gz $opt_result");
-}
-
rm_all($bench_tmpdir);
rm_all("$opt_tmp") if ($new_opt_tmp);
@@ -344,57 +402,105 @@ $0 version 1.4
$0 takes the following options:
+--bdb
+Compile with support for Berkeley DB tables
+
+--config-env <environment for configure>
+To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
+
+--config-options <options>
+To add some extra options to configure (e.g. '--with-perl=yes')
+
+--dbd-options <options>
+Options for Makefile.PL when configuring msql-mysql-modules.
+
+--debug
+Print all shell commands on stdout.
+
+--delete
+Delete the distribution file.
+
+--distribution <distribution_file>
+Name of the MySQL source distribution file.
+
+--enable-shared
+Compile with shared libraries
+
+--fast-benchmark
+Run fast benchmark only to speed up testing
+
--help or --Information
Show this help
--innodb
Compile with support for Innodb tables
---bdb
-Compile with support for Berkeley DB tables
+--libwrap
+Compile with TCP wrapper support
---user 'user_name'
-Mail 'user_name'\@mysql.com if something went wrong.
-If user is empty then no mail is sent.
+--local-perl
+Install Perl modules locally
---distribution 'distribution_file'
-Name of the MySQL distribution file.
+--make-options <options>
+Options to make after configure. (Like 'CXXLD=gcc')
---result 'result_dir'
-Send binary distribution to result_dir
+--no-crash-me
+Do not run the "crash-me" test
---no-delete
-Do not delete the distribution file.
+--no-strip
+Do not strip the binaries included in the binary distribution
+
+--no-test
+Do not run any tests
--perl-files=list of files
Compile and install the given perl modules.
---no-test
-Don not run crash-me or the benchmarks.
+--perl-options <options>
+Build Perl modules with the additional options
---config-options 'some extra configure options'
-To add some extra options, like '--with-perl=yes'
+--raid
+Compile with RAID support
---config-env 'environment for configure'
-To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
+--stage (1-6)
+Start script from some specific point.
---dbd-options 'options'
-Options for Makefile.PL when configuring msql-mysql-modules.
+--static-client
+Build statically linked client binaries
---make-options 'options'
-Options to make after configure. (Like 'CXXLD=gcc')
+--static-perl
+Build statically linked Perl modules
+
+--static-server
+Build statically linked server binary
+
+--tcpip
+Connect to the server to be tested via TCP/IP instead of socket
+
+--tmp <directory>
+Use a different temporary directory than /tmp
+
+--use-old-distribution
+Do not clean up the build environment and extract a fresh source
+distribution, use an existing one instead.
+
+--user <user_name>
+Mail 'user_name'\@mysql.com if something went wrong.
+If user is empty then no mail is sent.
--version-suffix suffix
-Can be used to set a suffix (normally 'com' or '-max') for a distribution
+Set name suffix (e.g. 'com' or '-max') for a distribution
--with-low-memory
Use less memory when compiling.
--- stage (1-6)
-Start script from some specific point.
+--with-other-libc <path to libc>
+Link against libc and other standard libraries installed in the specified
+non-standard location overriding default.
--- debug
-Print all shell commands on stdout.
+--with-small-disk
+Clean up the build environment before testing the binary distribution
+(to save disk space)
EOF
exit 1;
}
@@ -402,7 +508,7 @@ exit 1;
sub abort
{
my($message)=@_;
- my($command,$mail_header_file);
+ my($mail_header_file);
print LOG "\n$message\n";
print "$host: $message\n" if ($opt_debug);
close LOG;
@@ -413,11 +519,10 @@ sub abort
open(TMP,">$mail_header_file");
print TMP "From: mysql\@$full_host_name\n";
print TMP "To: $email\n";
- print TMP "Subject: MySQL compilation failed again\n\n";
+ print TMP "Subject: $ver$opt_version_suffix compilation failed\n\n";
close TMP;
- $command=($opt_rsh_mail) ? "$rsh analytik" : "";
- system("tail -30 $log > $log.mail");
- system("cat $mail_header_file $log.mail | $command $sendmail -t -f $email");
+ system("tail -40 $log > $log.mail");
+ system("cat $mail_header_file $log.mail | $sendmail -t -f $email");
unlink($mail_header_file);
unlink("$log.mail");
}
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright
index 0d49acac400..68673f3f53f 100755
--- a/Build-tools/mysql-copyright
+++ b/Build-tools/mysql-copyright
@@ -89,7 +89,7 @@ sub main
}
# everything should be ok, continue with extracting..
- `gtar xfz ../$distfile`;
+ `tar xfz ../$distfile`;
$pec= $? >> 8;
abort($dir, "Extracting from tar failed!\n") if ($pec);
@@ -107,7 +107,7 @@ sub main
`mv -f $destdir $newdistname`;
# tar the new distribution
- `gtar cz -f $opt_target/$newdistname.tar.gz *`;
+ `tar cz -f $opt_target/$newdistname.tar.gz *`;
$pec= $? >> 8;
abort($dir, "Making new tar archive failed!\n") if ($pec);
diff --git a/Docs/manual.texi b/Docs/manual.texi
index e8bd1ac53e3..d9e6afc4cfc 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -152,12 +152,11 @@ database server.
production systems as well as for embedding into mass-deployed software.
@code{MySQL} is a trademark of @code{MySQL AB}.
-The @code{MySQL} software has @code{Dual Licensing}, which means you can use
-the @code{MySQL} software free of charge under the
-@code{GNU General Public License} (@uref{http://www.gnu.org/licenses/}).
-You can also purchase commercial @code{MySQL} licenses from
-@code{MySQL AB} if you do not wish to be bound by the terms of the
-@code{GPL}.
+The @code{MySQL} software is @code{Dual Licensed}. Users can choose to
+use the @code{MySQL} software as an @code{Open Source}/@code{Free Software}
+product under the terms of the @code{GNU General Public License}
+(@uref{http://www.gnu.org/licenses/}) or can purchase a standard
+commercial license from @code{MySQL AB}.
@xref{Licensing and Support}.
The @code{MySQL} web site (@uref{http://www.mysql.com/}) provides the
@@ -215,6 +214,7 @@ For a list of all the contributors to this project, see @ref{Credits}.
Reports of errors (often called bugs), as well as questions and comments,
should be sent to the mailing list at @email{mysql@@lists.mysql.com}.
@xref{Bug reports}.
+
The @code{mysqlbug} script should be used to generate bug reports.
@c FIX! RPMs are also binary
For source distributions, the @code{mysqlbug} script can be found in the
@@ -271,7 +271,7 @@ The PostScript version is produced using @code{texi2dvi} and @code{dvips}.
The PDF version is produced with @code{pdftex}.
If you have a hard time finding information in the manual, you can try
-our searchable PHP version at @uref{http://www.mysql.com/doc/}.
+our searchable version at @uref{http://www.mysql.com/doc/}.
If you have any suggestions concerning additions or corrections to this
manual, please send them to the documentation team at @email{docs@@mysql.com}.
@@ -404,9 +404,9 @@ alternatives are listed within braces (@samp{@{} and @samp{@}}):
@cindex MySQL, introduction
@code{MySQL}, the most popular @code{Open Source} SQL database, is
-developed and provided by @code{MySQL AB}. @code{MySQL AB} is a
-commercial company that builds its business providing services around
-the @code{MySQL} database.
+developed, distributed and supported by @code{MySQL AB}. @code{MySQL AB} is a
+commercial company founded by the MySQL developers that builds its business
+providing services around the @code{MySQL} database.
@xref{What is MySQL AB}.
The @code{MySQL} web site (@uref{http://www.mysql.com/})
@@ -1793,7 +1793,7 @@ and @code{row-level locking}.
@item
Our German, Austrian, and Swiss users will note that we have a new character
-set, @code{latin_de}, which corrects the @emph{German sorting order},
+set, @code{latin1_de}, which corrects the @emph{German sorting order},
placing German umlauts in the same order as German telephone books.
@item
@@ -2304,12 +2304,14 @@ to do and is a powerful way to get information about any table in a database
that will help us create a situation matching the one you have.
@item
-For speed-related bugs or problems with @code{SELECT} statements, you should
-always include the output of @code{EXPLAIN SELECT ...}, and at least the
-number of rows that the @code{SELECT} statement produces. The more
-information you give about your situation, the more likely it is that someone
-can help you! For example, the following is an example of a very good bug
-report (it should of course be posted with the @code{mysqlbug} script):
+For speed-related bugs or problems with @code{SELECT} statements, you
+should always include the output of @code{EXPLAIN SELECT ...}, and at
+least the number of rows that the @code{SELECT} statement produces. You
+should also include the output from @code{SHOW CREATE TABLE table_name}
+for each involved table. The more information you give about your
+situation, the more likely it is that someone can help you! For
+example, the following is an example of a very good bug report (it
+should of course be posted with the @code{mysqlbug} script):
Example run using the @code{mysql} command-line tool (note the use of the
@code{\G} statement terminator for statements whose output width would
@@ -2612,7 +2614,7 @@ executed only if the MySQL version is equal to or newer than the used
version number:
@example
-CREATE /*!32302 TEMPORARY */ TABLE (a int);
+CREATE /*!32302 TEMPORARY */ TABLE t (a int);
@end example
This means that if you have Version 3.23.02 or newer, MySQL
@@ -3409,9 +3411,6 @@ database if you are not using the @code{-A} option or if you are using
@code{rehash}. This is especially notable when you have a big table
cache.
-@item
-The current replication protocol cannot deal with @code{LOAD DATA INFILE}
-and line terminator characters of more than 1 character.
@end itemize
The following problems are known and will be fixed in due time:
@@ -3423,6 +3422,10 @@ When using @code{SET CHARACTER SET}, one can't use translated
characters in database, table, and column names.
@item
+One can't use @code{_} or @code{%} with @code{ESCAPE} in @code{LIKE
+... ESCAPE}.
+
+@item
If you have a @code{DECIMAL} column with a number stored in different
formats (+01.00, 1.00, 01.00), @code{GROUP BY} may regard each value
as a different value.
@@ -3465,6 +3468,11 @@ that in MySQL Server, @code{VARCHAR} columns are treated the same way.
You can only have up to 255 @code{ENUM} and @code{SET} columns in one table.
@item
+In @code{MIN()}, @code{MAX()} and other aggregate functions, MySQL
+currently compares @code{ENUM} and @code{SET} columns by their string
+value rather than by the string's relative position in the set.
+
+@item
@code{safe_mysqld} redirects all messages from @code{mysqld} to the
@code{mysqld} log. One problem with this is that if you execute
@code{mysqladmin refresh} to close and reopen the log,
@@ -6122,7 +6130,7 @@ and are configured with the following compilers and options:
@code{CFLAGS="-O3 -mpentium -mstack-align-double" CXX=gcc CXXFLAGS="-O3 -mpentium -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=complex}
@item Linux 2.2.x with x686 with @code{gcc} 2.95.2
-@code{CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex}
+@code{CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex}
@item SCO 3.2v5.0.4 i386 with @code{gcc} 2.7-95q4
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex}
@@ -6846,7 +6854,7 @@ If the build fails and produces errors about your compiler or linker not
being able to create the shared library @file{libmysqlclient.so.#} (@samp{#}
is a version number), you can work around this problem by giving the
@code{--disable-shared} option to @code{configure}. In this case,
-@code{configure} will not build a shared @code{libmysqlclient.so.#} library.
+@code{configure} will not build a shared @file{libmysqlclient.so.#} library.
@cindex default values, suppression
@cindex suppression, default values
@@ -7830,7 +7838,7 @@ reload the grant tables.
@cindex problems, starting the server
If you are going to use tables that support transactions (InnoDB, BDB),
-you should first create a my.cnf file and set startup options
+you should first create a @file{my.cnf} file and set startup options
for the table types you plan to use. @xref{Table types}.
Generally, you start the @code{mysqld} server in one of these ways:
@@ -7971,7 +7979,7 @@ If you are using InnoDB tables, refer to the InnoDB-specific startup
options. @xref{InnoDB start}.
If you are using BDB (Berkeley DB) tables, you should familiarise
-yourself with the different BDB specific startup options. @xref{BDB start}.
+yourself with the different BDB-specific startup options. @xref{BDB start}.
@node Automatic start, , Starting server, Post-installation
@@ -8123,7 +8131,7 @@ on all ISAM tables.
@item
Ensure that you don't have any MySQL clients that uses shared libraries
(like the perl Msql-Mysql-modules). If you have, you should recompile
-them as structures used in libmysqlclient.so have changed.
+them as structures used in @file{libmysqlclient.so} have changed.
@end itemize
MySQL 4.0 will work even if you don't do the above, but you will not be
@@ -8328,7 +8336,7 @@ link and the original database are deleted. (This didn't happen in 3.22
because configure didn't detect the @code{readlink} system call.)
@item
-@code{OPTIMIZE TABLE} now only works for @code{MyISAM} tables.
+@code{OPTIMIZE TABLE} now works only for @code{MyISAM} tables.
For other table types, you can use @code{ALTER TABLE} to optimise the table.
During @code{OPTIMIZE TABLE} the table is now locked from other threads.
@@ -8355,7 +8363,7 @@ and not only the first argument.
@item
@code{AUTO_INCREMENT} will not work with negative numbers. The reason
for this is that negative numbers caused problems when wrapping from -1 to 0.
-@code{AUTO_INCREMENT} for MyISAM tables is no handled at a lower level and
+@code{AUTO_INCREMENT} for MyISAM tables is now handled at a lower level and
is much faster than before. For MyISAM tables old numbers are also not reused
anymore, even if you delete some rows from the table.
@@ -8707,7 +8715,7 @@ cat /proc/sys/fs/super-max
@end example
If you have more than 16 MB of memory, you should add something like the
-following in your boot script (@file{/etc/rc/boot.local} on SuSE):
+following to your init scripts (e.g. @file{/etc/init.d/boot.local} on SuSE Linux):
@example
echo 65536 > /proc/sys/fs/file-max
@@ -8715,10 +8723,22 @@ echo 8192 > /proc/sys/fs/dquot-max
echo 1024 > /proc/sys/fs/super-max
@end example
-You can also run the preceding commands from the command-line as root, but in this case
-your old limits will be used the next time your computer reboots.
+You can also run the preceding commands from the command-line as root, but
+these settings will be lost the next time your computer reboots.
-You should also add /etc/my.cnf:
+Alternatively, you can set these parameters on bootup by using the
+@code{sysctl} tool, which is used by many Linux distributions (SuSE has
+added it as well, beginning with SuSE Linux 8.0). Just put the following
+values into a file named @file{/etc/sysctl.conf}:
+
+@example
+# Increase some values for MySQL
+fs.file-max = 65536
+fs.dquot-max = 8192
+fs.super-max = 1024
+@end example
+
+You should also add the following to @file{/etc/my.cnf}:
@example
[safe_mysqld]
@@ -8891,7 +8911,7 @@ Copy @code{libmysqclient.so} to @file{/usr/lib}.
@tindex LD_RUN_PATH environment variable
@tindex environment variable, LD_RUN_PATH
@item
-Add the pathname of the directory where @code{libmysqlclient.so} is located
+Add the pathname of the directory where @file{libmysqlclient.so} is located
to the @code{LD_RUN_PATH} environment variable before running your client.
@end itemize
@@ -9092,23 +9112,27 @@ tested on Linux-Alpha. If you plan to use MySQL on Linux-Alpha,
you should ensure that you have this version or newer.
We have tested MySQL on Alpha with our benchmarks and test suite,
-and it appears to work nicely. The main thing we haven't yet had time to
-test is how things works with many concurrent users.
+and it appears to work nicely.
-When we compiled the standard MySQL binary we are using SuSE 6.4,
-kernel 2.2.13-SMP, Compaq C compiler (V6.2-504) and Compaq C++ compiler
-(V6.3-005) on a Comaq DS20 machine with an Alpha EV6 processor.
+We currently build the MySQL binary packages on SuSE Linux 7.0 for AXP,
+kernel 2.4.4-SMP, Compaq C compiler (V6.2-505) and Compaq C++ compiler
+(V6.3-006) on a Compaq DS20 machine with an Alpha EV6 processor.
You can find the above compilers at
@uref{http://www.support.compaq.com/alpha-tools/}). By using these compilers,
instead of gcc, we get about 9-14% better performance with MySQL.
-Note that the configure line optimised the binary for the current CPU; this
-means you can only use our binary if you have an Alpha EV6 processor. We also
-compile statically to avoid library problems.
+Note that until MySQL version 3.23.52 and 4.0.2 we optimised the binary for
+the current CPU only (by using the @code{-fast} compile option); this meant
+that you could only use our binaries if you had an Alpha EV6 processor.
+
+Starting with all following releases we added the @code{-arch generic} flag
+to our compile options, which makes sure the binary runs on all Alpha
+processors. We also compile statically to avoid library problems.
@example
-CC=ccc CFLAGS="-fast" CXX=cxx CXXFLAGS="-fast -noexceptions -nortti" \
+CC=ccc CFLAGS="-fast -arch generic" CXX=cxx \
+CXXFLAGS="-fast -arch generic -noexceptions -nortti" \
./configure --prefix=/usr/local/mysql --disable-shared \
--with-extra-charsets=complex --enable-thread-safe-client \
--with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared
@@ -10458,6 +10482,18 @@ CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
--with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
@end example
+The following configure line should work with gcc 3.1:
+
+@example
+CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc \
+CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions \
+-fno-rtti -O3 -fPIC" ./configure --prefix=/usr/local/mysql \
+--with-extra-charsets=complex --enable-thread-safe-client \
+--enable-local-infile --with-pthread \
+--with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC
+--disable-shared
+@end example
+
@node HP-UX 11.x, IBM-AIX, HP-UX 10.20, Other Unix Notes
@subsubsection HP-UX Version 11.x Notes
@@ -11424,7 +11460,7 @@ Compile the @code{Msql-Mysql-modules} distribution with @code{perl
Makefile.PL -static -config} rather than @code{perl Makefile.PL}.
@item
-Copy @code{libmysqlclient.so} to the directory where your other shared
+Copy @file{libmysqlclient.so} to the directory where your other shared
libraries are located (probably @file{/usr/lib} or @file{/lib}).
@item
@@ -13370,7 +13406,7 @@ mysql> SELECT * FROM shop;
* example-Foreign keys:: Using foreign keys
* Searching on two keys:: Searching on Two Keys
* Calculating days:: Calculating Visits Per Day
-* example-AUTO_INCREMENT:: Using AUTO_INCREMENT
+* example-AUTO_INCREMENT:: Using @code{AUTO_INCREMENT}
@end menu
@@ -13419,7 +13455,7 @@ WHERE price=19.95
@end enumerate
Another solution is to sort all rows descending by price and only
-get the first row using the MySQL specific @code{LIMIT} clause:
+get the first row using the MySQL-specific @code{LIMIT} clause:
@example
SELECT article, dealer, price
@@ -14702,7 +14738,7 @@ If you need to do this more permanently, you should create an option
file for each server. @xref{Option files}. In your startup script that
is executed at boot time you should specify for both servers:
-@code{safe_mysqld --default-file=path-to-option-file}
+@code{safe_mysqld --defaults-file=path-to-option-file}
At least the following options should be different per server:
@@ -14900,7 +14936,7 @@ system. This section describes how it works.
Anyone using MySQL on a computer connected to the Internet
should read this section to avoid the most common security mistakes.
-In discussing security, we emphasize the necessity of fully protecting the
+In discussing security, we emphasise the necessity of fully protecting the
entire server host (not simply the MySQL server) against all types
of applicable attacks: eavesdropping, altering, playback, and denial of
service. We do not cover all aspects of availability and fault tolerance
@@ -16537,6 +16573,7 @@ GRANT priv_type [(column_list)] [, priv_type [(column_list)] ...]
TO user_name [IDENTIFIED BY [PASSWORD] 'password']
[, user_name [IDENTIFIED BY 'password'] ...]
[REQUIRE
+ NONE |
[@{SSL| X509@}]
[CIPHER cipher [AND]]
[ISSUER issuer [AND]]
@@ -17612,6 +17649,9 @@ mysql> GRANT ALL PRIVILEGES ON test.* TO root@@localhost
-> AND CIPHER "EDH-RSA-DES-CBC3-SHA";
@end example
+Starting from MySQL 4.0.4 the @code{AND} keyword is optional between
+@code{REQUIRE} options.
+
The order of the options does not matter, but no option can be specified
twice.
@end itemize
@@ -17753,7 +17793,7 @@ BACKUP TABLE tbl_name[,tbl_name...] TO '/path/to/backup/directory'
Copies to the backup directory the minimum number of table files needed
to restore the table, after flushing any buffered changes to disk. Currently
-only works for @code{MyISAM} tables.
+works only for @code{MyISAM} tables.
For @code{MyISAM} tables, copies @file{.frm} (definition) and
@file{.MYD} (data) files. The index file can be rebuilt from those two.
@@ -17817,7 +17857,7 @@ CHECK TABLE tbl_name[,tbl_name...] [option [option...]]
option = QUICK | FAST | MEDIUM | EXTENDED | CHANGED
@end example
-@code{CHECK TABLE} only works on @code{MyISAM} and @code{InnoDB} tables. On
+@code{CHECK TABLE} works only on @code{MyISAM} and @code{InnoDB} tables. On
@code{MyISAM} tables it's the same thing as running @code{myisamchk -m
table_name} on the table.
@@ -17924,7 +17964,7 @@ to set the column to some other value than 0.
REPAIR TABLE tbl_name[,tbl_name...] [QUICK] [EXTENDED] [USE_FRM]
@end example
-@code{REPAIR TABLE} only works on @code{MyISAM} tables and is the same
+@code{REPAIR TABLE} works only on @code{MyISAM} tables and is the same
as running @code{myisamchk -r table_name} on the table.
Normally you should never have to run this command, but if disaster strikes
@@ -17955,10 +17995,11 @@ If @code{QUICK} is given then MySQL will try to do a
If you use @code{EXTENDED} then MySQL will create the index row
by row instead of creating one index at a time with sorting; this may be
-better than sorting on fixed-length keys if you have long @code{char()}
-keys that compress very good.
+better than sorting on fixed-length keys if you have long @code{CHAR}
+keys that compress very well. This type of repair is like that done by
+@code{myisamchk --safe-recover}.
-As of @code{MySQL} 4.0.2 there is a @code{USE_FRM} mode for @code{REPAIR}.
+As of @code{MySQL} 4.0.2, there is a @code{USE_FRM} mode for @code{REPAIR}.
Use it if the @file{.MYI} file is missing or if its header is corrupted.
In this mode MySQL will recreate the table, using information from the
@file{.frm} file. This kind of repair cannot be done with @code{myisamchk}.
@@ -19127,7 +19168,7 @@ Deleted records are maintained in a linked list and subsequent @code{INSERT}
operations reuse old record positions. You can use @code{OPTIMIZE TABLE} to
reclaim the unused space and to defragment the datafile.
-For the moment, @code{OPTIMIZE TABLE} only works on @code{MyISAM} and
+For the moment, @code{OPTIMIZE TABLE} works only on @code{MyISAM} and
@code{BDB} tables. For @code{BDB} tables, @code{OPTIMIZE TABLE} is
currently mapped to @code{ANALYZE TABLE}.
@xref{ANALYZE TABLE, , @code{ANALYZE TABLE}}.
@@ -19306,7 +19347,7 @@ Otherwise, you can only see and kill your own threads.
You can also use the @code{mysqladmin processlist} and @code{mysqladmin kill}
commands to examine and kill threads.
-When you do a @code{KILL}, a thread specific @code{kill flag} is set for
+When you do a @code{KILL}, a thread-specific @code{kill flag} is set for
the thread.
In most cases it may take some time for the thread to die as the kill
@@ -19609,7 +19650,7 @@ is high, it is a good indication that your queries and tables are properly index
@item @code{Handler_read_next} @tab Number of requests to read next row in key order. This
will be incremented if you are querying an index column with a range constraint. This also
will be incremented if you are doing an index scan.
-@item @code{Handler_read_prev} @tab Number of requests to read previous row in key order. This is mainly used to optimize @code{ORDER BY ... DESC}.
+@item @code{Handler_read_prev} @tab Number of requests to read previous row in key order. This is mainly used to optimise @code{ORDER BY ... DESC}.
@item @code{Handler_read_rnd} @tab Number of requests to read a row based on a fixed position.
This will be high if you are doing a lot of queries that require sorting of the result.
@item @code{Handler_read_rnd_next} @tab Number of requests to read the next row in the datafile.
@@ -19712,92 +19753,130 @@ The output resembles that shown here, though the format and numbers may
differ somewhat:
@example
-+------------------------------+---------------------------+
-| Variable_name | Value |
-+------------------------------+---------------------------+
-| ansi_mode | OFF |
-| back_log | 50 |
-| basedir | /my/monty/ |
-| bdb_cache_size | 16777216 |
-| bdb_log_buffer_size | 32768 |
-| bdb_home | /my/monty/data/ |
-| bdb_max_lock | 10000 |
-| bdb_logdir | |
-| bdb_shared_data | OFF |
-| bdb_tmpdir | /tmp/ |
-| binlog_cache_size | 32768 |
-| bulk_insert_buffer_size | 8388608 |
-| concurrent_insert | ON |
-| connect_timeout | 5 |
-| datadir | /my/monty/data/ |
-| delay_key_write | ON |
-| delayed_insert_limit | 100 |
-| delayed_insert_timeout | 300 |
-| delayed_queue_size | 1000 |
-| flush | OFF |
-| flush_time | 0 |
-| ft_min_word_len | 4 |
-| ft_max_word_len | 254 |
-| ft_max_word_len_for_sort | 20 |
-| ft_boolean_syntax | + -><()~* |
-| have_bdb | YES |
-| have_innodb | YES |
-| have_raid | YES |
-| have_openssl | NO |
-| init_file | |
-| interactive_timeout | 28800 |
-| join_buffer_size | 131072 |
-| key_buffer_size | 16776192 |
-| language | /my/monty/share/english/ |
-| large_files_support | ON |
-| log | OFF |
-| log_update | OFF |
-| log_bin | OFF |
-| log_slave_updates | OFF |
-| long_query_time | 10 |
-| low_priority_updates | OFF |
-| lower_case_table_names | 0 |
-| max_allowed_packet | 1048576 |
-| max_binlog_cache_size | 4294967295 |
-| max_connections | 100 |
-| max_connect_errors | 10 |
-| max_delayed_threads | 20 |
-| max_heap_table_size | 16777216 |
-| max_join_size | 4294967295 |
-| max_sort_length | 1024 |
-| max_tmp_tables | 32 |
-| max_write_lock_count | 4294967295 |
-| myisam_recover_options | DEFAULT |
-| myisam_sort_buffer_size | 8388608 |
-| net_buffer_length | 16384 |
-| net_read_timeout | 30 |
-| net_retry_count | 10 |
-| net_write_timeout | 60 |
-| open_files_limit | 0 |
-| pid_file | /my/monty/data/donna.pid |
-| port | 3306 |
-| protocol_version | 10 |
-| read_buffer_size | 131072 |
-| query_cache_limit | 1048576 |
-| query_cache_size | 16768060 |
-| query_cache_type | 1 |
-| safe_show_database | OFF |
-| server_id | 0 |
-| skip_locking | ON |
-| skip_networking | OFF |
-| skip_show_database | OFF |
-| slow_launch_time | 2 |
-| socket | /tmp/mysql.sock |
-| sort_buffer | 2097116 |
-| table_cache | 64 |
-| table_type | MYISAM |
-| thread_cache_size | 4 |
-| thread_stack | 65536 |
-| tmp_table_size | 1048576 |
-| tmpdir | /tmp/ |
-| version | 3.23.29a-gamma-debug |
-| wait_timeout | 28800 |
-+------------------------------+---------------------------+
++---------------------------------+------------------------------+
+| Variable_name | Value |
++---------------------------------+------------------------------|
+| back_log | 50 |
+| basedir | /usr/local/mysql |
+| bdb_cache_size | 8388572 |
+| bdb_log_buffer_size | 32768 |
+| bdb_home | /usr/local/mysql |
+| bdb_max_lock | 10000 |
+| bdb_logdir | |
+| bdb_shared_data | OFF |
+| bdb_tmpdir | /tmp/ |
+| bdb_version | Sleepycat Software: ... |
+| binlog_cache_size | 32768 |
+| bulk_insert_buffer_size | 8388608 |
+| character_set | latin1 |
+| character_sets | latin1 big5 czech euc_kr |
+| concurrent_insert | ON |
+| connect_timeout | 5 |
+| convert_character_set | |
+| datadir | /usr/local/mysql/data/ |
+| delay_key_write | ON |
+| delayed_insert_limit | 100 |
+| delayed_insert_timeout | 300 |
+| delayed_queue_size | 1000 |
+| flush | OFF |
+| flush_time | 0 |
+| ft_min_word_len | 4 |
+| ft_max_word_len | 254 |
+| ft_max_word_len_for_sort | 20 |
+| ft_boolean_syntax | + -><()~*:""&| |
+| have_bdb | YES |
+| have_innodb | YES |
+| have_isam | YES |
+| have_raid | NO |
+| have_symlink | DISABLED |
+| have_openssl | YES |
+| have_query_cache | YES |
+| init_file | |
+| innodb_additional_mem_pool_size | 1048576 |
+| innodb_buffer_pool_size | 8388608 |
+| innodb_data_file_path | ibdata1:10M:autoextend |
+| innodb_data_home_dir | |
+| innodb_file_io_threads | 4 |
+| innodb_force_recovery | 0 |
+| innodb_thread_concurrency | 8 |
+| innodb_flush_log_at_trx_commit | 0 |
+| innodb_fast_shutdown | ON |
+| innodb_flush_method | |
+| innodb_lock_wait_timeout | 50 |
+| innodb_log_arch_dir | |
+| innodb_log_archive | OFF |
+| innodb_log_buffer_size | 1048576 |
+| innodb_log_file_size | 5242880 |
+| innodb_log_files_in_group | 2 |
+| innodb_log_group_home_dir | ./ |
+| innodb_mirrored_log_groups | 1 |
+| interactive_timeout | 28800 |
+| join_buffer_size | 131072 |
+| key_buffer_size | 16773120 |
+| language | /usr/local/mysql/share/... |
+| large_files_support | ON |
+| local_infile | ON |
+| locked_in_memory | OFF |
+| log | OFF |
+| log_update | OFF |
+| log_bin | OFF |
+| log_slave_updates | OFF |
+| log_slow_queries | OFF |
+| log_warnings | OFF |
+| long_query_time | 10 |
+| low_priority_updates | OFF |
+| lower_case_table_names | OFF |
+| max_allowed_packet | 1047552 |
+| max_binlog_cache_size | 4294967295 |
+| max_binlog_size | 1073741824 |
+| max_connections | 100 |
+| max_connect_errors | 10 |
+| max_delayed_threads | 20 |
+| max_heap_table_size | 16777216 |
+| max_join_size | 4294967295 |
+| max_sort_length | 1024 |
+| max_user_connections | 0 |
+| max_tmp_tables | 32 |
+| max_write_lock_count | 4294967295 |
+| myisam_max_extra_sort_file_size | 268435456 |
+| myisam_max_sort_file_size | 2147483647 |
+| myisam_recover_options | force |
+| myisam_sort_buffer_size | 8388608 |
+| net_buffer_length | 16384 |
+| net_read_timeout | 30 |
+| net_retry_count | 10 |
+| net_write_timeout | 60 |
+| open_files_limit | 0 |
+| pid_file | /usr/local/mysql/name.pid |
+| port | 3306 |
+| protocol_version | 10 |
+| read_buffer_size | 131072 |
+| read_rnd_buffer_size | 262144 |
+| rpl_recovery_rank | 0 |
+| query_cache_limit | 1048576 |
+| query_cache_size | 0 |
+| query_cache_type | ON |
+| safe_show_database | OFF |
+| server_id | 0 |
+| slave_net_timeout | 3600 |
+| skip_external_locking | ON |
+| skip_networking | OFF |
+| skip_show_database | OFF |
+| slow_launch_time | 2 |
+| socket | /tmp/mysql.sock |
+| sort_buffer_size | 2097116 |
+| sql_mode | 0 |
+| table_cache | 64 |
+| table_type | MYISAM |
+| thread_cache_size | 3 |
+| thread_stack | 131072 |
+| tx_isolation | READ-COMMITTED |
+| timezone | EEST |
+| tmp_table_size | 33554432 |
+| tmpdir | /tmp/ |
+| version | 4.0.4-beta |
+| wait_timeout | 28800 |
++---------------------------------+------------------------------+
@end example
Each option is described here. Values for buffer sizes, lengths, and stack
@@ -20188,7 +20267,7 @@ want to increase this value.
@item @code{record_rnd_buffer_size}
When reading rows in sorted order after a sort, the rows are read
through this buffer to avoid a disk seeks. Can improve @code{ORDER BY}
-by a lot if set to a high value. As this is a thread specific variable,
+by a lot if set to a high value. As this is a thread-specific variable,
one should not set this big globally, but just change this when running
some specific big queries.
@@ -20300,8 +20379,13 @@ The directory used for temporary files and temporary tables.
The version number for the server.
@item @code{wait_timeout}
-The number of seconds the server waits for activity on a connection before
-closing it. See also @code{interactive_timeout}.
+The number of seconds the server waits for activity on a not interactive
+connection before closing it.
+
+On thread startup @code{SESSION.WAIT_TIMEOUT} is initialised from
+@code{GLOBAL.WAIT_TIMEOUT} or @code{GLOBAL.INTERACTIVE_TIMEOUT} depending
+on the type of client (as defined by the @code{CLIENT_INTERACTIVE} connect
+option). See also @code{interactive_timeout}.
@end itemize
The manual section that describes tuning MySQL contains some
@@ -20525,7 +20609,7 @@ the @code{SELECT} statement.
You can change the character set with the @code{--default-character-set}
option when you start the server. The character sets available depend
-on the @code{--with-charset=charset} and @code{--with-extra-charset=
+on the @code{--with-charset=charset} and @code{--with-extra-charsets=
list-of-charset | complex | all} options to @code{configure}, and the
character set configuration files listed in
@file{SHAREDIR/charsets/Index}. @xref{configure options}.
@@ -20576,7 +20660,7 @@ but normally this is never needed.
@subsubsection German character set
To get German sorting order, you should start @code{mysqld} with
-@code{--default-character-set=latin_de}. This will give you the following
+@code{--default-character-set=latin1_de}. This will give you the following
characteristics.
When sorting and comparing string's the following mapping is done on the
@@ -20682,7 +20766,7 @@ When defining the character set, every word must be a number in hexadecimal
format
@item
The @code{ctype} array takes up the first 257 words. The
-@code{to_lower}, @code{to_upper} and @code{sort_order} arrays take up
+@code{to_lower[]}, @code{to_upper[]} and @code{sort_order[]} arrays take up
256 words each after that.
@end itemize
@@ -20843,9 +20927,10 @@ multi-byte characters, you need to use the multi-byte character
functions.
Right now the best documentation on this is the character sets that are
-already implemented. Look at the euc_kr, gb2312, gbk, sjis and ujis
-character sets for examples. These are implemented in the
-@code{ctype-'charset'.c} files in the @file{strings} directory.
+already implemented. Look at the @code{euc_kr}, @code{gb2312},
+@code{gbk}, @code{sjis}, and @code{ujis} character sets for
+examples. These are implemented in the @file{ctype-'charset'.c} files
+in the @file{strings} directory.
You must specify the @code{mbmaxlen_MYSET=N} value in the special
comment at the top of the source file. @code{N} should be set to the
@@ -20864,7 +20949,7 @@ Your program has a wrong path to where the character sets are stored.
This can be fixed by using the @code{--character-sets-dir}
option to the program in question.
@item
-The character set is a multi-byte-character set that can't be loaded
+The character set is a multi-byte character set that can't be loaded
dynamically. In this case you have to recompile the program with the
support for the character set.
@item
@@ -20883,7 +20968,7 @@ In this case you should either get a new @code{Index} file or add
by hand the name of any missing character sets.
@end itemize
-For MyISAM tables, you can check the character set name and number for a
+For @code{MyISAM} tables, you can check the character set name and number for a
table with @code{myisamchk -dvv table_name}.
@@ -22754,7 +22839,7 @@ state.
The @code{--single-transaction} option was added in version 4.0.2.
This option is mutually exclusive with the @code{--lock-tables} option
-as @code{LOCK TABLES} cancels a previous transaction.
+as @code{LOCK TABLES} already commits a previous transaction internally.
@item -S /path/to/socket, --socket=/path/to/socket
The socket file to use when connecting to @code{localhost} (which is the
default host).
@@ -23336,7 +23421,7 @@ To the binary log filename @code{mysqld} will append an extension that
is a number that is incremented each time you execute @code{mysqladmin
refresh}, execute @code{mysqladmin flush-logs}, execute the @code{FLUSH
LOGS} statement or restart the server. A new binary log will also
-automatically be created when it reaches @code{max_bin_log_size}. You can
+automatically be created when it reaches @code{max_binlog_size}. You can
delete all not active binary log files with the @code{RESET MASTER}
command. @xref{RESET}.
@@ -23385,13 +23470,13 @@ The binary logging is done immediately after a query completes but before
any locks are released or any commit is done. This ensures that the log
will be logged in the execution order.
-Any updates to a non-transactional table are stored in the binary log at
-once. All updates (@code{UPDATE}, @code{DELETE} or @code{INSERT}) that change
-a transactional table (like BDB tables) are cached until a @code{COMMIT}.
-Every thread will, on start, allocate a buffer of
-@code{binlog_cache_size} to buffer queries. If a query is bigger than
-this, the thread will open a temporary file to handle the bigger cache.
-The temporary file will be deleted when the thread ends.
+Updates to a non-transactional table are stored in the binary log at
+once. For transactional tables such as @code{BDB} ! or @code{InnoDB}
+tables, all updates are cached until a @code{COMMIT}. Every thread
+will, on start, allocate a buffer of @code{binlog_cache_size} to buffer
+queries. If a query is bigger than this, the thread will open a
+temporary file to handle the bigger cache. The temporary file will be
+deleted when the thread ends.
The @code{max_binlog_cache_size} can be used to restrict the total size used
to cache a multi-query transaction.
@@ -23625,7 +23710,7 @@ For more details, please see @ref{Replication FAQ}.
If you want to become a real MySQL replication guru, we suggest that you
begin by studying, pondering, and trying all commands
-mentioned in @ref{Replication SQL}. You should also familiarize yourself
+mentioned in @ref{Replication SQL}. You should also familiarise yourself
with replication startup options in @file{my.cnf} in
@ref{Replication Options}.
@@ -23913,7 +23998,7 @@ the slave. The other bug is that if the ignored table gets partially
updated, the slave thread will not notice that the table actually should
have been ignored and will suspend the replication process. While the
above bugs are conceptually very simple to fix, we have not yet found a way
-to do this without a sigficant code change that would compromize the stability
+to do this without a significant code change that would compromise the stability
status of 3.23 branch. There exists a workaround for both if in the rare case
it happens to affect your application -- use @code{slave-skip-errors}.
@end itemize
@@ -24101,7 +24186,7 @@ updates that uses a table in any databases that start with @code{foo}
and whose table names start with @code{bar}.
@item @code{replicate-wild-ignore-table=db_name.table_name} @tab
-Tells the slave thread to not replicate a query whare any table matches the
+Tells the slave thread to not replicate a query where any table matches the
given wildcard pattern. To specify more than one table to ignore, use
the directive multiple times, once for each table. This will work for
cross-database updates.
@@ -24316,7 +24401,8 @@ MASTER_LOG_SEQ=log_seq AND MASTER_SERVER_ID=server_id} @tab
This command is used when a slave of a possibly dead/unavailable master
needs to be switched to replicate off another slave that has been
replicating the same master. The command will return recalculated
-replication coordinates, and the output can be used in a subsequent
+replication coordinates (the slave's current binary log file
+name and position within that file). The output can be used in a subsequent
@code{CHANGE MASTER TO} command. Normal users should never need to run
this command. It is primarily reserved for internal use by the fail-safe
replication code. We may later change the syntax if we find a more
@@ -25302,12 +25388,15 @@ To see what indexes a table has, use @code{SHOW INDEX FROM tbl_name}.
@item key
The @code{key} column indicates the key (index) that MySQL actually
-decided to use. The key is @code{NULL} if no index was chosen. If
-MySQL chooses the wrong index, you can probably force
-MySQL to use another index by using @code{myisamchk --analyze},
-@xref{myisamchk syntax}, or by using @code{USE INDEX/IGNORE INDEX}.
+decided to use. The key is @code{NULL} if no index was chosen. To force
+MySQL to use an key listed in the @code{possible_keys} column, use
+@code{USE KEY/IGNORE KEY} in your query.
@xref{SELECT}.
+Also, running @code{myisamchk --analyze} (@pxref{myisamchk syntax}) or
+@code{ANALYZE TABLE} (@pxref{ANALYZE TABLE}) on the table will help the
+optimiser choose better indexes.
+
@item key_len
The @code{key_len} column indicates the length of the key that
MySQL decided to use. The length is @code{NULL} if the
@@ -25425,7 +25514,7 @@ this join type is good.
Only rows that are in a given range will be retrieved, using an index to
select the rows. The @code{key} column indicates which index is used.
The @code{key_len} contains the longest key part that was used.
-The @code{ref} column will be NULL for this type.
+The @code{ref} column will be @code{NULL} for this type.
@item index
This is the same as @code{ALL}, except that only the index tree is
@@ -25716,8 +25805,9 @@ Constant condition removal (needed because of constant folding):
Constant expressions used by indexes are evaluated only once.
@item
@code{COUNT(*)} on a single table without a @code{WHERE} is retrieved
-directly from the table information for MyISAM and HEAP tables. This is
-also done for any @code{NOT NULL} expression when used with only one table.
+directly from the table information for @code{MyISAM} and @code{HEAP} tables.
+This is also done for any @code{NOT NULL} expression when used with only one
+table.
@item
Early detection of invalid constant expressions. MySQL quickly
detects that some @code{SELECT} statements are impossible and returns no rows.
@@ -25828,9 +25918,9 @@ the scanning of the not used tables as soon as it has found the first match.
SELECT DISTINCT t1.a FROM t1,t2 where t1.a=t2.a;
@end example
-In the case, assuming t1 is used before t2 (check with @code{EXPLAIN}), then
-MySQL will stop reading from t2 (for that particular row in t1)
-when the first row in t2 is found.
+In the case, assuming @code{t1} is used before @code{t2} (check with
+@code{EXPLAIN}), then MySQL will stop reading from @code{t2} (for that
+particular row in @code{t1}) when the first row in @code{t2} is found.
@node LEFT JOIN optimisation, ORDER BY optimisation, DISTINCT optimisation, Query Speed
@@ -25948,7 +26038,7 @@ do the @code{ORDER BY}:
@item
You are joining many tables and the columns you are doing an @code{ORDER
-BY} on are not all from the first not-const table that is used to
+BY} on are not all from the first not-@code{const} table that is used to
retrieve rows (This is the first table in the @code{EXPLAIN} output which
doesn't use a @code{const} row fetch method).
@@ -25973,7 +26063,7 @@ algorithm:
@itemize @bullet
@item
Read all rows according to key or by table scanning.
-Rows that doesn't match the WHERE clause are skipped.
+Rows that don't match the @code{WHERE} clause are skipped.
@item
Store the sort-key in a buffer (of size @code{sort_buffer}).
@item
@@ -26148,11 +26238,11 @@ flush-tables}.
Note that @code{LOAD DATA INFILE} also does the above optimisation if
you insert into an empty table; the main difference with the above
-procedure is that you can let myisamchk allocate much more temporary
+procedure is that you can let @code{myisamchk} allocate much more temporary
memory for the index creation that you may want MySQL to allocate for
every index recreation.
-Since @strong{MySQL 4.0} you can also use
+Since MySQL 4.0 you can also use
@code{ALTER TABLE tbl_name DISABLE KEYS} instead of
@code{myisamchk --keys-used=0 -rq /path/to/db/tbl_name} and
@code{ALTER TABLE tbl_name ENABLE KEYS} instead of
@@ -26255,8 +26345,8 @@ Always check that all your queries really use the indexes you have created
in the tables. In MySQL you can do this with the @code{EXPLAIN}
command. @xref{EXPLAIN, Explain, Explain, manual}.
@item
-Try to avoid complex @code{SELECT} queries on MyISAM tables that are updated a
-lot. This is to avoid problems with table locking.
+Try to avoid complex @code{SELECT} queries on @code{MyISAM} tables that are
+updated a lot. This is to avoid problems with table locking.
@item
The new @code{MyISAM} tables can insert rows in a table without deleted
rows at the same time another table is reading from it. If this is important
@@ -26264,7 +26354,7 @@ for you, you should consider methods where you don't have to delete rows
or run @code{OPTIMIZE TABLE} after you have deleted a lot of rows.
@item
Use @code{ALTER TABLE ... ORDER BY expr1,expr2...} if you mostly
-retrieve rows in expr1,expr2... order. By using this option after big
+retrieve rows in @code{expr1,expr2...} order. By using this option after big
changes to the table, you may be able to get higher performance.
@item
In some cases it may make sense to introduce a column that is 'hashed'
@@ -26294,7 +26384,8 @@ introduce a new table and update the counter in real time. An update of
type @code{UPDATE table set count=count+1 where index_column=constant}
is very fast!
-This is really important when you use databases like MySQL that
+This is really important when you use MySQL table types like MyISAM and
+ISAM that
only have table locking (multiple readers / single writers). This will
also give better performance with most databases, as the row locking
manager in this case will have less to do.
@@ -26532,7 +26623,7 @@ As updates on tables normally are considered to be more important than
than statements that retrieve information from a table. This should
ensure that updates are not 'starved' because one issues a lot of heavy
queries against a specific table. (You can change this by using
-LOW_PRIORITY with the statement that does the update or
+@code{LOW_PRIORITY} with the statement that does the update or
@code{HIGH_PRIORITY} with the @code{SELECT} statement.)
Starting from MySQL Version 3.23.7 one can use the
@@ -26577,7 +26668,7 @@ You can give a specific @code{INSERT}, @code{UPDATE}, or @code{DELETE}
statement lower priority with the @code{LOW_PRIORITY} attribute.
@item
-Start @code{mysqld} with a low value for @strong{max_write_lock_count} to give
+Start @code{mysqld} with a low value for @code{max_write_lock_count} to give
@code{READ} locks after a certain number of @code{WRITE} locks.
@item
@@ -26702,7 +26793,7 @@ having it on all columns by default.
If you don't have any variable-length columns (@code{VARCHAR},
@code{TEXT}, or @code{BLOB} columns), a fixed-size record format is
used. This is faster but unfortunately may waste some space.
-@xref{MyISAM table formats}.
+@xref{MyISAM table formats, , @code{MyISAM} table formats}.
@item
The primary index of a table should be as short as possible. This makes
@@ -26946,9 +27037,9 @@ For @code{BLOB} and @code{TEXT} columns, you must index a prefix of the
column. You cannot index the entire column.
In MySQL Version 3.23.23 or later, you can also create special
-@strong{FULLTEXT} indexes. They are used for full-text search. Only the
+@code{FULLTEXT} indexes. They are used for full-text search. Only the
@code{MyISAM} table type supports @code{FULLTEXT} indexes. They can be
-created only from @code{VARCHAR} and @code{TEXT} columns.
+created only from @code{CHAR}, @code{VARCHAR}, and @code{TEXT} columns.
Indexing always happens over the entire column and partial indexing is not
supported. See @ref{Fulltext Search} for details.
@@ -27031,9 +27122,9 @@ MySQL is multi-threaded, so it may have many queries on the same table
simultaneously. To minimise the problem with two threads having
different states on the same file, the table is opened independently by
each concurrent thread. This takes some memory but will normaly increase
-performance. Wth ISAM and MyISAM tables this also requires one extra file
-descriptor for the datafile. With these table types the index file
-descriptor is shared between all threads.
+performance. Wth @code{ISAM} and @code{MyISAM} tables this also requires
+one extra file descriptor for the datafile. With these table types the index
+file descriptor is shared between all threads.
You can read more about this topic in the next section. @xref{Table cache}.
@@ -27066,7 +27157,7 @@ Make sure that your operating system can handle the number of open file
descriptors implied by the @code{table_cache} setting. If
@code{table_cache} is set too high, MySQL may run out of file
descriptors and refuse connections, fail to perform queries, and be very
-unreliable. You also have to take into account that the MyISAM table
+unreliable. You also have to take into account that the @code{MyISAM} table
handler needs two file descriptors for each unique open table. You can
in increase the number of file descriptors available for MySQL with
the @code{--open-files-limit=#} startup option. @xref{Not enough file
@@ -27091,7 +27182,7 @@ a thread is no longer using a table.
When someone executes @code{mysqladmin refresh} or
@code{mysqladmin flush-tables}.
@item
-When someone executes 'FLUSH TABLES'
+When someone executes a @code{FLUSH TABLES} statement.
@end itemize
When the table cache fills up, the server uses the following procedure
@@ -27124,9 +27215,9 @@ statement, a dedicated table object is allocated for the thread.
This table object is not shared by other threads an will not be closed
until the thread calls @code{HANDLER table_name CLOSE} or the thread dies.
@xref{HANDLER, , @code{HANDLER}}. When this happens, the table is put
-back in the table_cache (if it isn't full).
+back in the table cache (if it isn't full).
-You can check if your table cache is too small by checking the mysqld
+You can check if your table cache is too small by checking the @code{mysqld}
variable @code{Opened_tables}. If this is quite big, even if you
haven't done a lot of @code{FLUSH TABLES}, you should increase your table
cache. @xref{SHOW STATUS, , @code{SHOW STATUS}}.
@@ -27443,7 +27534,7 @@ threads on a single processor. With more load/CPUs the difference should
get bigger.
@item
-Running with @code{--log-bin} makes @strong{[MySQL} 1% slower.
+Running with @code{--log-bin} makes MySQL 1% slower.
@item
Compiling on Linux-x86 using gcc without frame pointers
@@ -27487,8 +27578,8 @@ a query is running, a copy of the current query string is also allocated.
All threads share the same base memory.
@item
-Only the compressed ISAM / MyISAM tables are memory mapped. This is
-because the 32-bit memory space of 4GB is not large enough for most
+Only the compressed @code{ISAM} / @code{MyISAM} tables are memory mapped. This
+is because the 32-bit memory space of 4GB is not large enough for most
big tables. When systems with a 64-bit address space become more
common we may add general support for memory mapping.
@@ -27503,20 +27594,20 @@ random-read buffer is allocated to avoid disk seeks.
@item
All joins are done in one pass, and most joins can be done without even
-using a temporary table. Most temporary tables are memory-based (HEAP)
+using a temporary table. Most temporary tables are memory-based (@code{HEAP})
tables. Temporary tables with a big record length (calculated as the
sum of all column lengths) or that contain @code{BLOB} columns are
stored on disk.
-One problem in MySQL versions before Version 3.23.2 is that if a HEAP table
-exceeds the size of @code{tmp_table_size}, you get the error @code{The
+One problem in MySQL versions before Version 3.23.2 is that if a @code{HEAP}
+table exceeds the size of @code{tmp_table_size}, you get the error @code{The
table tbl_name is full}. In newer versions this is handled by
-automatically changing the in-memory (HEAP) table to a disk-based
-(MyISAM) table as necessary. To work around this problem, you can
+automatically changing the in-memory (@code{HEAP}) table to a disk-based
+(@code{MyISAM}) table as necessary. To work around this problem, you can
increase the temporary table size by setting the @code{tmp_table_size}
option to @code{mysqld}, or by setting the SQL option
@code{BIG_TABLES} in the client program. @xref{SET OPTION, ,
-@code{SET}}. In MySQL Version 3.20, the maximum size of the
+@code{SET} Syntax}. In MySQL Version 3.20, the maximum size of the
temporary table was @code{record_buffer*16}, so if you are using this
version, you have to increase the value of @code{record_buffer}. You can
also start @code{mysqld} with the @code{--big-tables} option to always
@@ -27719,9 +27810,11 @@ you would write:
@example
mysql> SET PASSWORD FOR bob@@"%.loc.gov" = PASSWORD("newpass");
+@end example
-or
+Which is equivalent to:
+@example
mysql> UPDATE mysql.user SET password=PASSWORD("newpass")
-> WHERE user="bob' AND host="%.loc.gov";
@end example
@@ -27905,8 +27998,8 @@ inode and by this will avoid some disk seeks.
@item
On Linux, you can get much more performance (up to 100% under load is
-not uncommon) by using hdparm to configure your disk's interface! The
-following should be quite good hdparm options for MySQL (and
+not uncommon) by using @code{hdparm} to configure your disk's interface! The
+following should be quite good @code{hdparm} options for MySQL (and
probably many other applications):
@example
@@ -27920,15 +28013,15 @@ man page for more information! If @code{hdparm} is not used wisely,
filesystem corruption may result. Backup everything before experimenting!
@item
-On many operating systems you can mount the disks with the 'async' flag to
-set the filesystem to be updated asynchronously. If your computer is
-reasonable stable, this should give you more performance without sacrificing
+On many operating systems you can mount the disks with the @code{-o async}
+option to set the filesystem to be updated asynchronously. If your computer is
+reasonably stable, this should give you more performance without sacrificing
too much reliability. (This flag is on by default on Linux.)
@item
If you don't need to know when a file was last accessed (which is not
really useful on a database server), you can mount your filesystems
-with the @code{noatime} flag.
+with the @code{-o noatime} option.
@end itemize
@menu
@@ -28021,7 +28114,7 @@ You should not symlink tables on systems that don't have a fully
working @code{realpath()} call. (At least Linux and Solaris support
@code{realpath()})
-In MySQL 4.0 symlinks are only fully supported for @code{MyISAM}
+In MySQL 4.0 symlinks are fully supported only for @code{MyISAM}
tables. For other table types you will probably get strange problems
when doing any of the above mentioned commands.
@@ -28031,11 +28124,11 @@ way (this is mostly relevant only for @code{MyISAM} tables).
@itemize @bullet
@item
In the data directory you will always have the table definition file
-and the data/index files.
+and the data and index files.
@item
-You can symlink the index file and the datafile to different directories
-independent of the other.
+You can symlink the index file and the data file to different directories
+independently of the other.
@item
The symlinking can be done from the operating system (if @code{mysqld} is
@@ -28043,28 +28136,31 @@ not running) or with the @code{INDEX/DATA DIRECTORY="path-to-dir"} command
in @code{CREATE TABLE}. @xref{CREATE TABLE}.
@item
-@code{myisamchk} will not replace a symlink with the index/file but
-work directly on the files the symlinks points to. Any temporary files
-will be created in the same directory where the data/index file is.
+@code{myisamchk} will not replace a symlink with the data or index file but
+work directly on the file the symlink points to. Any temporary files
+will be created in the same directory where the data or index file is
+located.
@item
When you drop a table that is using symlinks, both the symlink and the
-file the symlink points to is dropped. This is a good reason to why you
-should @strong{not} run @code{mysqld} as root and not allow persons to have write
-access to the MySQL database directories.
+file the symlink points to are dropped. This is a good reason to why you
+should @strong{not} run @code{mysqld} as @code{root} or allow
+persons to have write access to the MySQL database directories.
@item
-If you rename a table with @code{ALTER TABLE RENAME} and you don't change
-database, the symlink in the database directory will be renamed to the new
-name and the data/index file will be renamed accordingly.
+If you rename a table with @code{ALTER TABLE RENAME} and you don't move
+the table to another database, the symlinks in the database directory
+will be renamed to the new names and the data and index files will be
+renamed accordingly.
@item
If you use @code{ALTER TABLE RENAME} to move a table to another database,
-then the table will be moved to the other database directory and the old
-symlinks and the files they pointed to will be deleted.
+the table will be moved to the other database directory and the old
+symlinks and the files they pointed to will be deleted. (In other words,
+the new table will not be symlinked.)
@item
-If you are not using symlinks you should use the @code{--skip-symlink}
+If you are not using symlinks, you should use the @code{--skip-symlink}
option to @code{mysqld} to ensure that no one can drop or rename a file
outside of the @code{mysqld} data directory.
@end itemize
@@ -28078,7 +28174,7 @@ Things that are not yet supported:
@item
@code{CREATE TABLE} doesn't report if the table has symbolic links.
@item
-@code{mysqldump} doesn't include the symbolic links information in the output.
+@code{mysqldump} doesn't include the symbolic link information in the output.
@item
@code{BACKUP TABLE} and @code{RESTORE TABLE} don't respect symbolic links.
@end itemize
@@ -28351,8 +28447,8 @@ like an integer (64-bit precision). In string context these act like a binary
string where each pair of hex digits is converted to a character:
@example
-mysql> SELECT x'FF'
- -> 255
+mysql> SELECT x'4D7953514C';
+ -> MySQL
mysql> SELECT 0xa+0;
-> 10
mysql> SELECT 0x5061756c;
@@ -28605,16 +28701,18 @@ Starting from MySQL 4.0.3 we provide better access to a lot of system
and connection variables. One can change most of them without having to take
down the server.
-There are two kind of system variables: Thread (or connection) specific
+There are two kind of system variables: Thread-specific (or
+connection-specific)
variables that are unique to the current connection and global variables
-that are either used to configure global events or used as initial
-variables for a new connection.
+that are used to configure global events.
+Global variables also are used to set up the initial values of the
+corresponding thread-specific variables for new connections.
-When mysqld starts all global variables are initialised from command
-line arguments and option files. You can change the used value with the
-@code{SET GLOBAL} command. When a new thread is created the thread
-specific variables are initialised from the global variables and they
-will not change even if one issues a new @code{SET GLOBAL} command.
+When @code{mysqld} starts, all global variables are initialised from command
+line arguments and option files. You can change the value with the
+@code{SET GLOBAL} command. When a new thread is created, the thread-specific
+variables are initialised from the global variables and they
+will not change even if you issue a new @code{SET GLOBAL} command.
To set the value for a @code{GLOBAL} variable, you should use one
of the following syntaxes:
@@ -28625,7 +28723,7 @@ SET GLOBAL sort_buffer_size=value;
SET @@@@global.sort_buffer_size=value;
@end example
-To set the value for @code{SESSION} variable, you can use one of the
+To set the value for a @code{SESSION} variable, you can use one of the
following syntaxes:
@example
@@ -28657,15 +28755,15 @@ SHOW SESSION VARIABLES like 'sort_buffer_size';
When you @strong{retrieve} a variable value with the
@code{@@@@variable_name} syntax and you don't specify @code{GLOBAL} or
-@code{SESSION} then MySQL will return the thread specific
+@code{SESSION} then MySQL will return the thread-specific
(@code{SESSION}) value if it exists. If not, MySQL will return the
global value.
The reason for requiring @code{GLOBAL} for setting @code{GLOBAL} only
variables but not for retrieving them is to ensure that we don't later
-run into problems if we later would introduce a thread specific variable
-with the same name or remove a thread specific variable. In this case
-you could accidently change the state for the whole server and not
+run into problems if we later would introduce a thread-specific variable
+with the same name or remove a thread-specific variable. In this case,
+you could accidentally change the state for the server as a whole, rather than
just for your own connection.
The following is a full list of all variables that you change and retrieve
@@ -28722,7 +28820,7 @@ and if you can use @code{GLOBAL} or @code{SESSION} with them.
@item query_cache_size @tab num @tab GLOBAL
@item query_cache_type @tab enum @tab GLOBAL
@item read_buffer_size @tab num @tab GLOBAL | SESSION
-@item read_rnd_buffer_size num @tab GLOBAL | SESSION
+@item read_rnd_buffer_size @tab num @tab GLOBAL | SESSION
@item rpl_recovery_rank @tab num @tab GLOBAL
@item safe_show_database @tab bool @tab GLOBAL
@item server_id @tab num @tab GLOBAL
@@ -28770,7 +28868,7 @@ Here is a description of some of the variables:
@item identity @tab Alias for last_insert_id (Sybase compatiblity)
@item sql_low_priority_updates @tab Alias for low_priority_updates
@item sql_max_join_size @tab Alias for max_join_size
-@item delay_key_write_for_all_tables @tab If this and delay_key_write is set then all new MyISAM tables that are opened will use delayed key writes.
+@item delay_key_write_for_all_tables @tab If this and delay_key_write are set, then all new MyISAM tables that are opened will use delayed key writes.
@item version @tab Alias for VERSION() (Sybase (?) compatability)
@end multitable
@@ -31157,8 +31255,8 @@ stored into a temporary table) is calculated in MySQL Version
@item expr2 or expr3 returns an integer @tab integer
@end multitable
-If expr2 and expr3 are strings, then the result is case-sensitive if
-both strings are case-sensitive. (Starting from 3.23.51)
+If expr2 and expr3 are strings, then the result is case-insensitive if
+both strings are case-insensitive. (Starting from 3.23.51)
@findex CASE
@item CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ...] [ELSE result] END
@@ -33145,9 +33243,15 @@ anything; just use the string value as it would be a number:
@example
mysql> SELECT 1+'1';
- -> 2
+ -> 2
@end example
+If you use a number in string context the number will automaticly be
+converted to a @code{BINARY} string.
+
+mysql> SELECT concat("hello you ",2);
+ -> "hello you 2"
+
MySQL supports arithmetic with both signed and unsigned 64-bit values.
If you are using an numerical operations (like @code{+}) and one of the
operands are @code{unsigned integer}, then the result will be unsigned.
@@ -33479,7 +33583,7 @@ The given @code{key_string} will be used to crypt @code{string_to_encrypt}.
The return string will be a binary string where the first character
will be @code{CHAR(128 | key_number)}.
-The 128 is added to make it easier to recognize an encrypted key.
+The 128 is added to make it easier to recognise an encrypted key.
If you use a string key, @code{key_number} will be 127.
On error, this function returns @code{NULL}.
@@ -33553,7 +33657,7 @@ non-magic value (that is, a value that is not @code{NULL} and not @code{0}).
If you insert many rows at the same time with an insert statement,
@code{LAST_INSERT_ID()} returns the value for the first inserted row.
-The reason for this is so that you it makes it possible to easily reproduce
+The reason for this is to make it possible to easily reproduce
the same @code{INSERT} statement against some other server.
@cindex sequence emulation
@@ -33833,6 +33937,11 @@ mysql> SELECT student_name, MIN(test_score), MAX(test_score)
-> GROUP BY student_name;
@end example
+In @code{MIN()}, @code{MAX()} and other aggregate functions, MySQL
+currently compares @code{ENUM} and @code{SET} columns by their string
+value rather than by the string's relative position in the set.
+This will be rectified.
+
@findex SUM()
@item SUM(expr)
Returns the sum of @code{expr}. Note that if the return set has no rows,
@@ -34008,11 +34117,12 @@ table_name [[AS] alias] [USE INDEX (key_list)] [IGNORE INDEX (key_list)]
As of MySQL Version 3.23.12, you can give hints about which
index MySQL should use when retrieving information from a
table. This is useful if @code{EXPLAIN} shows that MySQL is
-using the wrong index. By specifying @code{USE INDEX (key_list)}, you
-can tell MySQL to use only one of the specified indexes to
-find rows in the table. The alternative syntax @code{IGNORE INDEX
-(key_list)} can be used to tell MySQL to not use some
+using the wrong index from the list of possible indexes. By specifying
+@code{USE INDEX (key_list)}, you can tell MySQL to use only one of the
+possible indexes to find rows in the table. The alternative syntax
+@code{IGNORE INDEX (key_list)} can be used to tell MySQL to not use some
particular index.
+
@code{USE/IGNORE KEY} are synonyms for @code{USE/IGNORE INDEX}.
@item
@@ -34296,7 +34406,7 @@ table_reference STRAIGHT_JOIN table_reference
table_reference LEFT [OUTER] JOIN table_reference join_condition
table_reference LEFT [OUTER] JOIN table_reference
table_reference NATURAL [LEFT [OUTER]] JOIN table_reference
-@{ oj table_reference LEFT OUTER JOIN table_reference ON conditional_expr @}
+@{ OJ table_reference LEFT OUTER JOIN table_reference ON conditional_expr @}
table_reference RIGHT [OUTER] JOIN table_reference join_condition
table_reference RIGHT [OUTER] JOIN table_reference
table_reference NATURAL [RIGHT [OUTER]] JOIN table_reference
@@ -34404,11 +34514,12 @@ cases where the join optimiser puts the tables in the wrong order.
As of MySQL Version 3.23.12, you can give hints about which
index MySQL should use when retrieving information from a
table. This is useful if @code{EXPLAIN} shows that MySQL is
-using the wrong index. By specifying @code{USE INDEX (key_list)}, you
-can tell MySQL to use only one of the specified indexes to
-find rows in the table. The alternative syntax @code{IGNORE INDEX
-(key_list)} can be used to tell MySQL to not use some
+using the wrong index from the list of possible indexes. By specifying
+@code{USE INDEX (key_list)}, you can tell MySQL to use only one of the
+possible indexes to find rows in the table. The alternative syntax
+@code{IGNORE INDEX (key_list)} can be used to tell MySQL to not use some
particular index.
+
@findex USE KEY
@findex IGNORE KEY
@code{USE/IGNORE KEY} are synonyms for @code{USE/IGNORE INDEX}.
@@ -34942,20 +35053,20 @@ only a given number of rows are changed.
@findex DELETE
@example
-DELETE [LOW_PRIORITY | QUICK] FROM table_name
+DELETE [LOW_PRIORITY] [QUICK] FROM table_name
[WHERE where_definition]
[ORDER BY ...]
[LIMIT rows]
or
-DELETE [LOW_PRIORITY | QUICK] table_name[.*] [,table_name[.*] ...]
+DELETE [LOW_PRIORITY] [QUICK] table_name[.*] [,table_name[.*] ...]
FROM table-references
[WHERE where_definition]
or
-DELETE [LOW_PRIORITY | QUICK]
+DELETE [LOW_PRIORITY] [QUICK]
FROM table_name[.*], [table_name[.*] ...]
USING table-references
[WHERE where_definition]
@@ -35100,6 +35211,9 @@ In other words, you can't access the values of the old row from a
@code{REPLACE} statement. In some old MySQL versions it appeared that
you could do this, but that was a bug that has been corrected.
+To be able to use @code{REPLACE} you must have @code{INSERT} and
+@code{DELETE} privileges for the table.
+
When you use a @code{REPLACE} command, @code{mysql_affected_rows()}
will return 2 if the new row replaced an old row. This is because
one row was inserted and then the duplicate was deleted.
@@ -35874,6 +35988,10 @@ SELECT * FROM tbl_name WHERE auto_col IS NULL
@end example
@item
+@code{CREATE TABLE} automatically commits the current InnoDB
+transaction if the MySQL binlogging is used.
+
+@item
@code{NULL} values are handled differently for @code{TIMESTAMP} columns than
for other column types. You cannot store a literal @code{NULL} in a
@code{TIMESTAMP} column; setting the column to @code{NULL} sets it to the
@@ -35996,7 +36114,7 @@ When you use @code{ORDER BY} or @code{GROUP BY} with a @code{TEXT} or
@item
In MySQL Version 3.23.23 or later, you can also create special
-@strong{FULLTEXT} indexes. They are used for full-text search. Only the
+@code{FULLTEXT} indexes. They are used for full-text search. Only the
@code{MyISAM} table type supports @code{FULLTEXT} indexes. They can be created
only from @code{VARCHAR} and @code{TEXT} columns.
Indexing always happens over the entire column, partial indexing is not
@@ -36004,7 +36122,13 @@ supported. See @ref{Fulltext Search} for details of operation.
@item
In MySQL Version 3.23.44 or later, @code{InnoDB} tables support checking of
-foreign key constraints. @xref{InnoDB}.
+foreign key constraints. @xref{InnoDB}. Note that the
+@code{FOREIGN KEY} syntax in InnoDB is more restricted than
+the syntax presented above. InnoDB does not allow
+@code{index_name} to be specified, and the columns of the referenced
+table always have to be explicitly named. Of actions, InnoDB supports
+only @code{ON DELETE CASCADE} and @code{ON DELETE SET NULL}.
+See the InnoDB manual section for the precise syntax.
For other table types, MySQL Server does parse the @code{FOREIGN KEY},
@code{CHECK}, and @code{REFERENCES} syntax in @code{CREATE TABLE} commands,
but without further action being taken. @xref{ANSI diff Foreign Keys}.
@@ -36278,7 +36402,7 @@ alter_specification:
or ADD PRIMARY KEY (index_col_name,...)
or ADD UNIQUE [index_name] (index_col_name,...)
or ADD FULLTEXT [index_name] (index_col_name,...)
- or ADD [CONSTRAINT symbol] FOREIGN KEY index_name (index_col_name,...)
+ or ADD [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition]
or ALTER [COLUMN] col_name @{SET DEFAULT literal | DROP DEFAULT@}
or CHANGE [COLUMN] old_col_name create_definition
@@ -36489,7 +36613,11 @@ deleted due to duplication of unique key values.
@cindex foreign keys
@cindex references
The @code{FOREIGN KEY}, @code{CHECK}, and @code{REFERENCES} clauses don't
-actually do anything. The syntax for them is provided only for compatibility,
+actually do anything, except for InnoDB type tables which support
+@code{ADD CONSTRAINT FOREIGN KEY (...) REFERENCES ... (...)}.
+Note that InnoDB does not allow a constraint @code{symbol} or @code{index_name}
+to be specified. @xref{InnoDB}.
+The syntax for other table types is provided only for compatibility,
to make it easier to port code from other SQL servers and to run applications
that create tables with references.
@xref{Differences from ANSI}.
@@ -36922,7 +37050,7 @@ Lock one table at a time until the thread gets all locks.
This policy ensures that table locking is deadlock free. There is
however other things one needs to be aware of with this schema:
-If you are using a @code{LOW_PRIORITY_WRITE} lock for a table, this
+If you are using a @code{LOW_PRIORITY WRITE} lock for a table, this
means only that MySQL will wait for this particlar lock until
there is no threads that wants a @code{READ} lock. When the thread has
got the @code{WRITE} lock and is waiting to get the lock for the next
@@ -37030,7 +37158,8 @@ You can set the default global isolation level for @code{mysqld} with
As of Version 3.23.23, MySQL has support for full-text indexing
and searching. Full-text indexes in MySQL are an index of type
-@code{FULLTEXT}. @code{FULLTEXT} indexes can be created from @code{VARCHAR}
+@code{FULLTEXT}. @code{FULLTEXT} indexes are used with MyISAM tables
+and can be created from @code{VARCHAR}
and @code{TEXT} columns at @code{CREATE TABLE} time or added later with
@code{ALTER TABLE} or @code{CREATE INDEX}. For large datasets, it will be
much faster to load your data into a table that has no @code{FULLTEXT}
@@ -37053,7 +37182,7 @@ mysql> INSERT INTO articles VALUES
-> (0,'MySQL Tutorial', 'DBMS stands for DataBase ...'),
-> (0,'How To Use MySQL Efficiently', 'After you went through a ...'),
-> (0,'Optimising MySQL','In this tutorial we will show ...'),
- -> (0,'1001 MySQL Trick','1. Never run mysqld as root. 2. ...'),
+ -> (0,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-> (0,'MySQL vs. YourSQL', 'In the following database comparison ...'),
-> (0,'MySQL Security', 'When configured properly, MySQL ...');
Query OK, 6 rows affected (0.00 sec)
@@ -37180,7 +37309,7 @@ mysql> SELECT * FROM articles WHERE MATCH (title,body)
| 1 | MySQL Tutorial | DBMS stands for DataBase ... |
| 2 | How To Use MySQL Efficiently | After you went through a ... |
| 3 | Optimising MySQL | In this tutorial we will show ... |
-| 4 | 1001 MySQL Trick | 1. Never run mysqld as root. 2. ... |
+| 4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... |
| 6 | MySQL Security | When configured properly, MySQL ... |
+----+------------------------------+-------------------------------------+
@end example
@@ -37638,7 +37767,7 @@ You can combine many statements and accept these all in one go with
the @code{COMMIT} command.
@item
You can execute @code{ROLLBACK} to ignore your changes (if you are not
-running in auto commit mode).
+running in auto-commit mode).
@item
If an update fails, all your changes will be restored. (With NTST tables all
changes that have taken place are permanent)
@@ -38217,7 +38346,7 @@ kind of benefits.)
@item
Do more efficient searches. If you know exactly what you are looking
after, you can search in just one of the split tables for some queries
-and use @code{MERGE} table for others. You can even have many
+and use a @code{MERGE} table for others. You can even have many
different @code{MERGE} tables active, with possible overlapping files.
@item
More efficient repairs. It's easier to repair the individual files that
@@ -38252,7 +38381,7 @@ You can only use identical @code{MyISAM} tables for a @code{MERGE} table.
@code{REPLACE} doesn't work.
@item
@code{MERGE} tables uses more file descriptors. If you are using a
-@code{MERGE} that maps over 10 tables and 10 users are using this, you
+@code{MERGE} table that maps over 10 tables and 10 users are using this, you
are using 10*10 + 10 file descriptors. (10 datafiles for 10 users
and 10 shared index files.)
@item
@@ -38408,8 +38537,8 @@ recovery}.
@end itemize
Most of the things true for @code{MyISAM} tables are also true for @code{ISAM}
-tables. @xref{MyISAM}. The major differences compared to @code{MyISAM}
-tables are:
+tables. @xref{MyISAM, , @code{MyISAM} tables}. The major differences compared
+to @code{MyISAM} tables are:
@itemize @bullet
@item @code{ISAM} tables are not binary portable across OS/Platforms.
@@ -38469,7 +38598,8 @@ to @code{MyISAM} tables where any prefix of the key can be used to find rows.
@item
@code{HEAP} doesn't support @code{AUTO_INCREMENT} columns.
@item
-@code{HEAP} doesn't support an index on a @code{NULL} column.
+Prior to MySQL 4.0.2, @code{HEAP} doesn't support an index on a @code{NULL}
+column.
@item
You can have non-unique keys in a @code{HEAP} table (this isn't common for
hashed tables).
@@ -38485,7 +38615,7 @@ are 100% dynamic (on inserting). No overflow areas and no extra key
space are needed. Deleted rows are put in a linked list and are
reused when you insert new data into the table.
@item
-You need enough extra memory for all HEAP tables that you want to use at
+You need enough extra memory for all @code{HEAP} tables that you want to use at
the same time.
@item
To free memory, you should execute @code{DELETE FROM heap_table},
@@ -38526,6 +38656,7 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2)
* Table and index:: Table and Index Structures
* File space management:: File Space Management and Disk I/O
* Error handling:: Error Handling
+* InnoDB change history:: InnoDB Change History
* InnoDB restrictions:: Restrictions on InnoDB Tables
* InnoDB contact information:: InnoDB Contact Information.
@end menu
@@ -39414,7 +39545,7 @@ the relevant files. If the formats are different and your tables
contain floating-point data, you have to use @file{mysqldump}
and @file{mysqlimport} to move those tables.
-A performance tip is to switch off the auto commit when you import
+A performance tip is to switch off auto-commit mode when you import
data into your database, assuming your tablespace has enough space for
the big rollback segment the big import transaction will generate.
Do the commit only after importing a whole table or a segment of
@@ -39435,7 +39566,7 @@ without InnoDB running out of memory.
In InnoDB all user activity happens inside transactions. If the
auto-commit mode is used in MySQL, then each SQL statement
-will form a single transaction. If the auto commit mode is
+will form a single transaction. If the auto-commit mode is
switched off, then we can think that a user always has a transaction
open. If he issues
the SQL @code{COMMIT} or @code{ROLLBACK} statement, that
@@ -39454,6 +39585,9 @@ transaction.
* InnoDB Locks set:: Locks Set by Different SQL Statements in InnoDB
* InnoDB Deadlock detection:: Deadlock Detection and Rollback
* InnoDB Consistent read example:: An Example of How the Consistent Read Works in InnoDB
+* Innodb deadlocks::
+* Innodb tuning::
+* Innodb Monitor::
@end menu
@@ -39674,7 +39808,7 @@ set by the SQL statement may be preserved. This is because InnoDB
stores row locks in a format where it cannot afterwards know which was
set by which SQL statement.
-@node InnoDB Consistent read example, , InnoDB Deadlock detection, InnoDB transaction model
+@node InnoDB Consistent read example, Innodb deadlocks, InnoDB Deadlock detection, InnoDB transaction model
@subsubsection An Example of How the Consistent Read Works in InnoDB
When you issue a consistent read, that is, an ordinary @code{SELECT}
@@ -39723,6 +39857,7 @@ use a locking read:
SELECT * FROM t LOCK IN SHARE MODE;
@end example
+@node Innodb deadlocks, Innodb tuning, InnoDB Consistent read example, InnoDB transaction model
@subsubsection How to cope with deadlocks?
Deadlocks are a classic problem in transactional databases,
@@ -39757,7 +39892,7 @@ Use less locking: if you can afford a @code{SELECT} to return
data from an old snapshot, do not add the clause
@code{FOR UPDATE} or @code{LOCK IN SHARE MODE} to it.
@item
-If nothing helps, serialize your transactions with table level
+If nothing helps, serialise your transactions with table level
locks: @code{LOCK TABLES t1 WRITE, t2 READ, ... ;
[do something with tables t1 and t2 here]; UNLOCK TABLES.}
Table level locks make you transactions to queue nicely,
@@ -39767,7 +39902,8 @@ and @code{UNLOCK TABLES} implicitly ends the transaction in a
@code{COMMIT}.
@end itemize
-@subsection Performance Tuning Tips
+@node Innodb tuning, Innodb Monitor, Innodb deadlocks, InnoDB transaction model
+@subsubsection Performance Tuning Tips
@strong{1.}
If the Unix @file{top} or the Windows @file{Task Manager} shows that
@@ -39854,11 +39990,12 @@ INSERT INTO yourtable VALUES (1, 2), (5, 5);
This tip is of course valid for inserts into any table type, not just InnoDB.
+@node Innodb Monitor, , Innodb tuning, InnoDB transaction model
@subsubsection The InnoDB Monitor
Starting from version 3.23.41 InnoDB includes the InnoDB
Monitor which prints information on the InnoDB internal state.
-When swithed on, InnoDB Monitor
+When switched on, InnoDB Monitor
will make the MySQL server @file{mysqld} to print data
(note: the MySQL client will not print anything)
to the standard
@@ -40105,13 +40242,12 @@ index. Note that if the primary key is long, the secondary indexes
will use more space.
@menu
-* InnoDB physical structure:: Physical Structure of an Index
-* InnoDB Insert buffering:: Insert Buffering
-* InnoDB Adaptive hash:: Adaptive Hash Indexes
-* InnoDB Physical record:: Physical Record Structure
+* InnoDB physical structure::
+* InnoDB Insert buffering::
+* InnoDB Adaptive hash::
+* InnoDB Physical record::
@end menu
-
@node InnoDB physical structure, InnoDB Insert buffering, Table and index, Table and index
@subsubsection Physical Structure of an Index
@@ -40380,7 +40516,6 @@ records are deleted only from the end, then the file space management
algorithm of InnoDB guarantees that fragmentation in the index will
not occur.
-
@node Error handling, InnoDB restrictions, File space management, InnoDB
@subsection Error Handling
@@ -40414,7 +40549,7 @@ they roll back the corresponding SQL statement.
@end itemize
-@node InnoDB restrictions, InnoDB contact information, Error handling, InnoDB
+@node InnoDB restrictions, InnoDB change history, Error handling, InnoDB
@subsection Restrictions on InnoDB Tables
@itemize @bullet
@@ -40423,7 +40558,7 @@ they roll back the corresponding SQL statement.
@strong{Warning}: do @strong{NOT} convert MySQL system tables from
MyISAM TO InnoDB tables! This is not supported; if you do this MySQL
will not restart until you restore the old system tables from a backup
-or re-generate them with the mysql_install_db script.
+or re-generate them with the @code{mysql_install_db} script.
@item
@code{SHOW TABLE STATUS} does not give accurate statistics
@@ -40480,8 +40615,581 @@ The maximum tablespace size is 4 billion database pages. This is also
the maximum size for a table. The minimum tablespace size is 10 MB.
@end itemize
+@node InnoDB change history, InnoDB contact information, InnoDB restrictions, InnoDB
+@subsection InnoDB Change History
+
+@subsubsection MySQL/InnoDB-3.23.53, October xx, 2002
+@itemize bullet
+@item
+We again use unbuffered disk i/o in Windows. Win XP and Win 2000
+read performance seems to be very poor with normal i/o.
+@item
+Allow dropping and creating a table even if
+innodb_force_recovery is set. One can use this to drop
+a table which would cause a crash in rollback or purge,
+or if a failed table import causes a runaway rollback in recovery.
+@item
+Fixed a bug: fast shutdown (which is the default) sometimes
+was slowed down by purge and insert buffer merge.
+@item
+Fixed a bug: doing a big SELECT from a table where
+no rows were visible in a consistent read could cause
+a very long (> 600 seconds) semaphore wait in btr0cur.c line 310.
+@end itemize
+
+@subsubsection MySQL/InnoDB-4.0.4, October 2, 2002
+@itemize bullet
+@item
+We again use unbuffered disk i/o in Windows. Win XP and Win 2000
+read performance seems to be very poor with normal i/o.
+@item
+Increased the max key length of InnoDB tables from 500 to 1024 bytes.
+@item
+Increased the table comment field in SHOW TABLE STATUS so that
+up to 16000 characters of foreign key definitions can be printed there.
+@item
+The auto-increment counter is no longer incremented if
+an insert of a row immediately fails in an error.
+@item
+Allow dropping and creating a table even if
+innodb_force_recovery is set. One can use this to drop
+a table which would cause a crash in rollback or purge,
+or if a failed table import causes a runaway rollback in recovery.
+@item
+Fixed a bug: Using ORDER BY primarykey DESC in 4.0.3 causes
+an assertion failure in btr0pcur.c, line 203.
+@item
+Fixed a bug: fast shutdown (which is the default) sometimes
+was slowed down by purge and insert buffer merge.
+@item
+Fixed a bug: doing a big SELECT from a table where
+no rows were visible in a consistent read could cause
+a very long (> 600 seconds) semaphore wait in btr0cur.c line 310.
+@item
+Fixed a bug: if the MySQL query cache was used, it did not get
+invalidated by a modification done by ON DELETE CASCADE or ...SET NULL.
+@item
+Fixed a bug: if you created a temporary table inside LOCK TABLES,
+and used that temporary table, that caused an assertion failure
+in ha_innodb.cc.
+@item
+Fixed a bug: if you set innodb_flush_log_at_trx_commit to 1, SHOW
+VARIABLES would show its value as 16 million.
+@end itemize
-@node InnoDB contact information, , InnoDB restrictions, InnoDB
+@subsubsection MySQL/InnoDB-4.0.3, August 28, 2002
+@itemize bullet
+@item
+Removed unnecessary deadlocks when inserts have to wait for
+a locking read, update, or delete to release its next-key lock.
+@item
+The MySQL HANDLER SQL commands now work also for InnoDB type tables.
+InnoDB does the HANDLER reads always as consistent reads.
+HANDLER is a direct access path to read individual indexes of tables.
+In some cases HANDLER can be used as a substitute of server-side cursors.
+@item
+Fixed a bug in 4.0.2: even a simple insert could crash the
+AIX version.
+@item
+Fixed a bug: if you used in a table name characters whose code is > 127,
+in DROP TABLE InnoDB could assert on line 155 of pars0sym.c.
+@item
+Compilation from source now provides a working version both on
+HP-UX-11 and HP-UX-10.20. The source of 4.0.2 worked only on 11,
+and the source of 3.23.52 only on 10.20.
+@item
+Fixed a bug: if compiled on 64-bit Solaris, InnoDB produced a bus error
+at startup.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.52, August 16, 2002
+@itemize bullet
+@item
+The feature set of 3.23 will be frozen from this version on. New features
+will go the the 4.0 branch, and only bug fixes will be made to the 3.23
+branch.
+@item
+Many CPU-bound join queries now run faster. On Windows also many
+other CPU-bound queries run faster.
+@item
+A new SQL command SHOW INNODB STATUS returns the output of the
+InnoDB Monitor to the client. The InnoDB Monitor now prints detailed info on
+the latest detected deadlock.
+@item
+InnoDB made the SQL query optimizer to avoid too much index-only
+range scans and choose full table scans instead. This is now fixed.
+@item
+"BEGIN" and "COMMIT" are now added in the binlog around transactions.
+The MySQL replication now respects transaction borders:
+a user will no longer see half transactions in replication slaves.
+@item
+A replication slave now prints in crash recovery the last
+master binlog position it was able to recover to.
+@item
+A new setting innodb_flush_log_at_trx_commit=2 makes InnoDB to write
+the log to the operating system file cache at each commit. This is
+almost as fast as the setting innodb_flush_log_at_trx_commit=0, and
+the setting 2 also has the nice feature that in a crash where the
+operating system does not crash, no committed transaction is lost.
+If the operating system crashes or there is a power outage, then
+the setting 2 is no safer than the setting 0.
+@item
+Added checksum fields to log blocks.
+@item
+SET FOREIGN_KEY_CHECKS=0 helps in importing tables
+in an arbitrary order which does not respect the foreign key rules.
+@item
+SET UNIQUE_CHECKS=0 speeds up table imports into InnoDB
+if you have UNIQUE constraints on secondary indexes.
+@item
+SHOW TABLE STATUS now lists also possible ON DELETE CASCADE or
+ON DELETE SET NULL in the comment field of the table.
+@item
+When CHECK TABLE is run on any InnoDB type table, it now
+checks also the adaptive hash index for all tables.
+@item
+If you defined ON DELETE CASCADE or SET NULL and updated the
+referenced key in the parent row, InnoDB deleted or updated
+the child row. This is now changed to conform to SQL-92: you get
+the error 'Cannot delete parent row'.
+@item
+Improved the auto-increment algorithm: now the first insert or
+SHOW TABLE STATUS initializes the auto-inc counter for the table.
+This removes almost all surprising deadlocks caused by
+SHOW TABLE STATUS.
+@item
+Aligned some buffers used in reading and writing to data files.
+This allows using unbuffered raw devices as data files in Linux.
+@item
+Fixed a bug: If you updated the primary key of a table so that only the
+case of characters changed, that could cause assertion
+failures, mostly in page0page.ic line 515.
+@item
+Fixed a bug: If you delete or update a row referenced in a foreign key
+constraint and the foreign key check has to wait for a lock,
+then the check may report an erroneous result. This
+affects also the ON DELETE... operation.
+@item
+Fixed a bug: A deadlock or a lock wait timeout error in InnoDB
+causes InnoDB to roll back the whole transaction, but MySQL could still
+write the earlier SQL statements to the binlog, even though
+InnoDB rolled them back. This could, for example, cause replicated
+databases to get out-of-sync.
+@item
+Fixed a bug: If the database happened to crash in the middle of a
+commit, then the recovery might leak tablespace pages.
+@item
+Fixed a bug: If you specified a non-latin1 character set in my.cnf,
+then, in contrary to what is stated in the manual, in a foreign key
+constraint a string type column had to have the same length specification
+in the referencing table and the referenced table.
+@item
+Fixed a bug: DROP TABLE or DROP DATABASE could fail if there
+simultaneously was a CREATE TABLE running.
+@item
+Fixed a bug: If you configured the buffer pool bigger than 2 GB in
+a 32-bit computer, InnoDB would assert in buf0buf.ic line 214.
+@item
+Fixed a bug: on 64-bit computers updating rows which contained the
+SQL NULL in some column could cause the undo log and the ordinary
+log to become corrupt.
+@item
+Fixed a bug: innodb_log_monitor caused a hang if it suppressed
+lock prints for a page.
+@item
+Fixed a bug: in the HP-UX-10.20 version mutexes would leak and cause
+race conditions and crashes in any part of InnoDB code.
+@item
+Fixed a bug: if you ran in the AUTOCOMMIT mode, executed a SELECT,
+and immediately after that a RENAME TABLE, then RENAME would fail and
+MySQL would complain about error 1192.
+@item
+Fixed a bug: if compiled on 64-bit Solaris, InnoDB produced a bus error
+at startup.
+@end itemize
+
+@subsubsection MySQL/InnoDB-4.0.2, July 10, 2002
+@itemize bullet
+@item
+InnoDB is essentially the same as InnoDB-3.23.51.
+@item
+If no innodb_data_file_path is specified, InnoDB at the database creation
+now creates a 10 MB auto-extending data file ibdata1 to the datadir
+of MySQL. In 4.0.1 the file was 64 MB and not auto-extending.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.51, June 12, 2002
+@itemize bullet
+@item
+Fixed a bug: a join could result in a seg fault in copying of a BLOB or
+TEXT column if some of the BLOB or TEXT columns in the table contained
+SQL NULL values.
+@item
+Fixed a bug: if you added self-referential foreign key constraints with
+ON DELETE CASCADE to tables and a row deletion caused InnoDB
+to attempt the deletion of the same row twice because of
+a cascading delete, then you got an assertion failure.
+@item
+Fixed a bug: if you use MySQL 'user level locks' and close
+a connection, then InnoDB may assert in ha_innobase.cc, line 302.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.50, April 23, 2002
+@itemize bullet
+@item
+InnoDB now supports an auto-extending last data file. You do not need
+to preallocate the whole data file at the database startup.
+@item
+Made several changes to facilitate the use of the InnoDB Hot Backup
+tool. It is a separate non-free tool you can use to take online backups
+of your database without shutting down the server or setting
+any locks.
+@item
+If you want to run the InnoDB Hot Backup tool on an auto-extending
+data file you have to upgrade it to version ibbackup-0.35.
+@item
+The log scan phase in crash recovery will now run much faster.
+@item
+Starting from this server version, the hot backup tool
+truncates unused ends in the backup InnoDB data files.
+@item
+To allow the hot backup tool to work, on Windows we no longer use
+unbuffered i/o or native async i/o; instead we use the same simulated
+async i/o as on Unix.
+@item
+You can now define the ON DELETE CASCADE or ON DELETE SET NULL
+clause on foreign keys.
+@item
+FOREIGN KEY constraints now survive ALTER TABLE and CREATE
+INDEX.
+@item
+We suppress the FOREIGN KEY check if any of the column values in the
+foreign key or referenced key to be checked is the SQL NULL. This
+is compatible with Oracle, for example.
+@item
+SHOW CREATE TABLE now lists also foreign key constraints. Also
+mysqldump no longer forgets about foreign keys in table definitions.
+@item
+You can now add a new foreign key constraint with
+ALTER TABLE ... ADD CONSTRAINT FOREIGN KEY (...) REFERENCES ... (...).
+@item
+FOREIGN KEY definitions now allow backquotes around table and
+column names.
+@item
+MySQL command
+SET TRANSACTION ISOLATION LEVEL ...
+has now the following effect on
+InnoDB tables: if a transaction is defined as SERIALIZABLE
+then InnoDB conceptually adds LOCK IN SHARE MODE
+to all consistent reads. If a transaction is defined to have any other
+isolation level, then InnoDB obeys its default locking strategy
+which is REPEATABLE READ.
+@item
+SHOW TABLE STATUS no longer sets an x-lock at the end of an
+auto-increment index if the auto-increment counter has already
+been initialized. This removes in almost all cases the surprising deadlocks
+caused by SHOW TABLE STATUS.
+@item
+Fixed a bug: in a CREATE TABLE statement the string 'foreign'
+followed by a non-space character confused the FOREIGN KEY parser
+and caused table creation to fail with errno 150.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.49, February 17, 2002
+@itemize bullet
+@item
+Fixed a bug: if you called DROP DATABASE for a database on which
+there simultaneously were running queries, the MySQL server could crash
+or hang. Crashes fixed, but a full fix has to wait some changes
+in the MySQL layer of code.
+@item
+Fixed a bug: on Windows one had to put the database name
+in lower case for DROP
+DATABASE to work. Fixed in 3.23.49: case no longer matters
+on Windows. On Unix the database name remains case-sensitive.
+@item
+Fixed a bug: if one defined a non-latin1 character set as
+the default character set,
+then definition of foreign key constraints could fail
+in an assertion failure
+in dict0crea.c, reporting an internal error 17.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.48, February 9, 2002
+@itemize bullet
+@item
+Tuned the SQL optimizer to favor more often index searches
+over table scans.
+@item
+Fixed a performance problem when several large SELECT
+queries are run concurrently on a multiprocessor Linux computer.
+Large CPU-bound SELECT queries will now also generally run faster on
+all platforms.
+@item
+If MySQL binlogging is used,
+InnoDB now prints after crash recovery the latest MySQL binlog
+file name and the position in that file (= byte offset)
+InnoDB was able to recover to. This is useful, for example,
+when resynchronizing a master and a slave database in replication.
+@item
+Added better error messages to help in installation problems.
+@item
+One can now recover also MySQL temporary tables which have become
+orphaned inside the InnoDB tablespace.
+@item
+InnoDB now prevents a FOREIGN KEY declaration where the signedness
+is not the same in the referencing and referenced integer columns.
+@item
+Fixed a bug: calling SHOW CREATE TABLE or SHOW TABLE STATUS
+could cause memory corruption and make mysqld to crash.
+Especially at risk was mysqldump, because it calls frequently
+SHOW CREATE TABLE.
+@item
+Fixed a bug: if on Unix you did an ALTER TABLE to an InnoDB table and
+simultaneously did queries to it, mysqld could crash with an assertion
+failure in row0row.c, line 474.
+@item
+Fixed a bug: if inserts to several tables containing an auto-inc column
+were wrapped inside one LOCK TABLES, InnoDB asserted in lock0lock.c.
+@item
+In 3.23.47 we allowed several NULLS in a UNIQUE secondary index.
+But CHECK TABLE was not relaxed: it reports the table as corrupt.
+CHECK TABLE no longer complains in this situation.
+@item
+Fixed a bug: on Sparc and other high-endian processors SHOW VARIABLES
+showed innodb_flush_log_at_trx_commit and other boolean-valued
+startup parameters always OFF even if they were switched on.
+@item
+Fixed a bug: if you ran mysqld-max-nt as a service on Windows NT/2000,
+the service shutdown did not always wait long enough for the InnoDB shutdown
+to finish.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.47, December 28, 2001
+@itemize bullet
+@item
+Recovery happens now faster, especially in a lightly loaded system,
+because background checkpointing has been made more frequent.
+@item
+InnoDB allows now several similar key values in a UNIQUE secondary index
+if those values contain SQL NULLs. Thus the convention is now the same as in
+MyISAM tables.
+@item
+InnoDB gives a better row count estimate for a table which contains BLOBs.
+@item
+In a FOREIGN KEY constraint InnoDB is now case-insensitive to column
+names, and in Windows also to table names.
+@item
+InnoDB allows a FOREIGN KEY column of CHAR type to refer to a column of
+VARCHAR type, and vice versa. MySQL silently changes the type of some
+columns between CHAR and VARCHAR, and these silent changes do not hinder
+FOREIGN KEY declaration any more.
+@item
+Recovery has been made more resilient to corruption of log files.
+@item
+Unnecessary statistics calculation has been removed from queries which
+generate a temporary table. Some ORDER BY and DISTINCT queries will now run
+much faster.
+@item
+MySQL now knows that the table scan of an InnoDB table is done through the
+primary key. This will save a sort in some ORDER BY queries.
+@item
+The maximum key length of InnoDB tables is again restricted to 500 bytes.
+The MySQL interpreter is not able to handle longer keys.
+@item
+The default value of innodb_lock_wait_timeout was changed from infinite to
+50 seconds, the default value of innodb_file_io_threads from 9
+to 4.
+@end itemize
+
+@subsubsection MySQL/InnoDB-4.0.1, December 23, 2001
+@itemize bullet
+@item
+InnoDB is the same as in 3.23.47.
+@item
+In 4.0.0 the MySQL interpreter did not know the syntax LOCK IN
+SHARE MODE. This has been fixed.
+@item
+In 4.0.0 multi-table delete did not work for transactional tables.
+This has been fixed.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.46, November 30, 2001
+@itemize bullet
+@item
+This is the same as 3.23.45.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.45, November 23, 2001
+@itemize bullet
+@item
+This is a bugfix release.
+@item
+In versions 3.23.42-.44 when creating a table on Windows you
+have to use lower case letters in the database name to be able to
+access the table. Fixed in 3.23.45.
+@item
+InnoDB now flushes stdout and stderr every 10 seconds: if these
+are redirected to files, the file contents can be better viewed with
+an editor.
+@item
+Fixed an assertion failure in .44, in trx0trx.c, line 178
+when you drop a table which has
+the .frm file but does not exist inside InnoDB.
+@item
+Fixed a bug in the insert buffer.
+The insert buffer tree could get into an inconsistent state, causing a crash,
+and also crashing the recovery. This bug could appear especially in
+large table imports or alterations.
+@item
+Fixed a bug in recovery: InnoDB could go into an infinite loop
+constantly printing
+a warning message that it cannot find free blocks from the buffer pool.
+@item
+Fixed a bug: when you created a temporary table of the InnoDB type, and then
+used ALTER TABLE to it, the MySQL server could crash.
+@item
+Prevented creation of MySQL system tables 'mysql.user',
+'mysql.host', or 'mysql.db', in the
+InnoDB type.
+@item
+Fixed a bug which can cause an assertion failure in 3.23.44 in
+srv0srv.c, line 1728.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.44, November 2, 2001
+@itemize bullet
+@item
+You can define foreign key constraints on InnoDB
+tables. An example: FOREIGN KEY (col1) REFERENCES table2(col2).
+@item
+You can create > 4 GB data files in those
+file systems that allow it.
+@item
+Improved InnoDB monitors, including a new innodb_table_monitor
+which allows you to print the contents of the InnoDB internal data
+dictionary.
+@item
+DROP DATABASE will now work also for InnoDB tables.
+@item
+Accent characters in the default character set
+latin1 will be ordered according to the MySQL ordering.<br>
+NOTE: if you are using latin1 and have inserted characters
+whose code is > 127 to an indexed CHAR column, you should run
+CHECK TABLE on your table when you upgrade to
+3.23.43, and drop and reimport the table if CHECK TABLE
+reports an error!
+@item
+InnoDB will calculate better table cardinality
+estimates.
+@item
+Change in deadlock resolution:
+in .43 a deadlock rolls back only the
+SQL statement, in .44 it will roll back the whole transaction.
+@item
+Deadlock, lock wait timeout, and foreign key
+constraint violations (no parent row, child rows exist)
+now return native MySQL
+error codes 1213, 1205, 1216, 1217, respectively.
+@item
+A new my.cnf parameter innodb_thread_concurrency
+helps in performance tuning in high concurrency environments.
+@item
+A new my.cnf option innodb_force_recovery will
+help you in dumping tables from a corrupted database.
+@item
+A new my.cnf option innodb_fast_shutdown will
+speed up shutdown. Normally InnoDB does a full purge
+and an insert buffer merge at shutdown.
+@item
+Raised maximum key length to 7000 bytes from a
+previous limit of 500 bytes.
+@item
+Fixed a bug in replication of auto-inc columns with multiline inserts.
+@item
+Fixed a bug when the case of letters changes in an update of an indexed
+secondary column.
+@item
+Fixed a hang when there are > 24 data files.
+@item
+Fixed a crash when MAX(col) is selected from an empty table, and col is a
+not the first column in a multi-column index.
+@item
+Fixed a bug in purge which could cause crashes.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.43, October 4, 2001
+@itemize bullet
+@item
+This is essentially the same as InnoDB-3.23.42.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.42, September 9, 2001
+@itemize bullet
+@item
+Fixed a bug which corrupted the table if the primary key
+of a > 8000-byte row was updated.
+@item
+There are now 3 types of InnoDB Monitors: innodb_monitor,
+innodb_lock_monitor, and innodb_tablespace_monitor.
+innodb_monitor now prints also buffer pool hit rate and the total
+number of rows inserted, updated, deleted, read.
+@item
+Fixed a bug in RENAME TABLE.
+@item
+Fixed a bug in replication with an auto-increment column.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.41, August 13, 2001
+@itemize bullet
+@item
+Support for < 4 GB rows. The previous limit was
+8000 bytes.
+@item
+Use the doublewrite file flush method.
+@item
+Raw disk partitions supported as data files.
+@item
+InnoDB Monitor.
+@item
+Several hang bugs fixed and an ORDER BY
+bug ('Sort aborted') fixed.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.40, July 16, 2001
+@itemize bullet
+@item
+Only a few rare bugs fixed.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.39, June 13, 2001
+@itemize bullet
+@item
+CHECK TABLE now works for InnoDB tables.
+@item
+A new my.cnf parameter innodb_unix_file_flush_method
+introduced. It can be used to tune disk write performance.
+@item
+An auto-increment column now gets new values past the
+transaction mechanism. This saves CPU time and eliminates
+transaction deadlocks in new value assignment.
+@item
+Several bug fixes, most notably the rollback bug in 3.23.38.
+@end itemize
+
+@subsubsection MySQL/InnoDB-3.23.38, May 12, 2001
+@itemize bullet
+@item
+The new syntax SELECT ... LOCK IN SHARE MODE is introduced.
+@item
+InnoDB now calls fsync after every disk write and calculates
+a checksum
+for every database page it writes or reads, which will reveal disk defects.
+@item
+Several bug fixes.
+@end itemize
+
+@node InnoDB contact information, , InnoDB change history, InnoDB
@subsection InnoDB Contact Information
Contact information of Innobase Oy, producer of the InnoDB engine.
@@ -40506,20 +41214,20 @@ Finland
@cindex tables, @code{Berkeley DB}
@menu
-* BDB overview:: Overview of BDB Tables
-* BDB install:: Installing BDB
-* BDB start:: BDB startup options
+* BDB overview:: Overview of @code{BDB} Tables
+* BDB install:: Installing @code{BDB}
+* BDB start:: @code{BDB} startup options
* BDB characteristics:: Characteristics of @code{BDB} tables:
-* BDB TODO:: Things we need to fix for BDB in the near future:
+* BDB TODO:: Things we need to fix for @code{BDB} in the near future:
* BDB portability:: Operating systems supported by @code{BDB}
-* BDB restrictions:: Restrictions on BDB Tables
-* BDB errors:: Errors That May Occur When Using BDB Tables
+* BDB restrictions:: Restrictions on @code{BDB} Tables
+* BDB errors:: Errors That May Occur When Using @code{BDB} Tables
@end menu
@node BDB overview, BDB install, BDB, BDB
-@subsection Overview of BDB Tables
+@subsection Overview of @code{BDB} Tables
-Support for BDB tables is included in the MySQL source distribution
+Support for @code{BDB} tables is included in the MySQL source distribution
starting from Version 3.23.34 and is activated in the MySQL-Max
binary.
@@ -40527,18 +41235,18 @@ BerkeleyDB, available at @uref{http://www.sleepycat.com/} has provided
MySQL with a transactional table handler. By using BerkeleyDB
tables, your tables may have a greater chance of surviving crashes, and also
provides @code{COMMIT} and @code{ROLLBACK} on transactions. The
-MySQL source distribution comes with a BDB distribution that has a
+MySQL source distribution comes with a @code{BDB} distribution that has a
couple of small patches to make it work more smoothly with MySQL.
You can't use a non-patched @code{BDB} version with MySQL.
We at MySQL AB are working in close cooperation with Sleepycat to
keep the quality of the MySQL/BDB interface high.
-When it comes to supporting BDB tables, we are committed to help our
+When it comes to supporting @code{BDB} tables, we are committed to help our
users to locate the problem and help creating a reproducable test case
-for any problems involving BDB tables. Any such test case will be
+for any problems involving @code{BDB} tables. Any such test case will be
forwarded to Sleepycat who in turn will help us find and fix the
-problem. As this is a two stage operation, any problems with BDB tables
+problem. As this is a two stage operation, any problems with @code{BDB} tables
may take a little longer for us to fix than for other table handlers.
However, as the BerkeleyDB code itself has been used by many other
applications than MySQL, we don't envision any big problems with
@@ -40546,7 +41254,7 @@ this. @xref{Support}.
@node BDB install, BDB start, BDB overview, BDB
-@subsection Installing BDB
+@subsection Installing @code{BDB}
If you have downloaded a binary version of MySQL that includes
support for BerkeleyDB, simply follow the instructions for installing a
@@ -40572,7 +41280,7 @@ soon.
@node BDB start, BDB characteristics, BDB install, BDB
-@subsection BDB startup options
+@subsection @code{BDB} startup options
If you are running with @code{AUTOCOMMIT=0} then your changes in @code{BDB}
tables will not be updated until you execute @code{COMMIT}. Instead of commit
@@ -40585,33 +41293,33 @@ committed until you execute @code{COMMIT} (or decide to @code{ROLLBACK}
the changes).
The following options to @code{mysqld} can be used to change the behaviour of
-BDB tables:
+@code{BDB} tables:
@multitable @columnfractions .25 .55
@item @strong{Option} @tab @strong{Description}
-@item @code{--bdb-home=directory} @tab Base directory for BDB tables. This should be the same directory you use for --datadir.
-@item @code{--bdb-lock-detect=#} @tab Berkeley lock detect. One of (DEFAULT, OLDEST, RANDOM, or YOUNGEST).
+@item @code{--bdb-home=directory} @tab Base directory for @code{BDB} tables. This should be the same directory you use for @code{--datadir}.
+@item @code{--bdb-lock-detect=#} @tab Berkeley lock detect. One of (@code{DEFAULT}, @code{OLDEST}, @code{RANDOM}, or @code{YOUNGEST}).
@item @code{--bdb-logdir=directory} @tab Berkeley DB log file directory.
@item @code{--bdb-no-sync} @tab Don't synchronously flush logs.
@item @code{--bdb-no-recover} @tab Don't start Berkeley DB in recover mode.
@item @code{--bdb-shared-data} @tab Start Berkeley DB in multi-process mode (Don't use @code{DB_PRIVATE} when initialising Berkeley DB)
-@item @code{--bdb-tmpdir=directory} @tab Berkeley DB tempfile name.
-@item @code{--skip-bdb} @tab Disable usage of BDB tables.
+@item @code{--bdb-tmpdir=directory} @tab Berkeley DB temporary file directory.
+@item @code{--skip-bdb} @tab Disable usage of @code{BDB} tables.
@item @code{-O bdb_max_lock=1000} @tab Set the maximum number of locks possible. @xref{SHOW VARIABLES}.
@end multitable
If you use @code{--skip-bdb}, MySQL will not initialise the
Berkeley DB library and this will save a lot of memory. Of course,
you cannot use @code{BDB} tables if you are using this option. If you try
-to create an BDB table, MySQL will instead create a MyISAM table.
+to create a @code{BDB} table, MySQL will instead create a @code{MyISAM} table.
Normally you should start @code{mysqld} without @code{--bdb-no-recover} if you
-intend to use BDB tables. This may, however, give you problems when you
-try to start @code{mysqld} if the BDB log files are corrupted. @xref{Starting
+intend to use @code{BDB} tables. This may, however, give you problems when you
+try to start @code{mysqld} if the @code{BDB} log files are corrupted. @xref{Starting
server}.
With @code{bdb_max_lock} you can specify the maximum number of locks
-(10000 by default) you can have active on a BDB table. You should
+(10000 by default) you can have active on a @code{BDB} table. You should
increase this if you get errors of type @code{bdb: Lock table is out of
available locks} or @code{Got error 12 from ...} when you have do long
transactions or when @code{mysqld} has to examine a lot of rows to
@@ -40627,11 +41335,12 @@ You may also want to change @code{binlog_cache_size} and
@itemize @bullet
@item
-To be able to rollback transactions BDB maintain log files. For maximum
+To be able to rollback transactions, the @code{BDB} handler maintains log
+files. For maximum
performance you should place these on another disk than your databases
by using the @code{--bdb-logdir} option.
@item
-MySQL performs a checkpoint each time a new BDB log
+MySQL performs a checkpoint each time a new @code{BDB} log
file is started, and removes any log files that are not needed for
current transactions. One can also run @code{FLUSH LOGS} at any time
to checkpoint the Berkeley DB tables.
@@ -40639,11 +41348,11 @@ to checkpoint the Berkeley DB tables.
For disaster recovery, one should use table backups plus
MySQL's binary log. @xref{Backup}.
-@strong{Warning}: If you delete old log files that are in use, BDB will
+@strong{Warning}: If you delete old log files that are in use, @code{BDB} will
not be able to do recovery at all and you may lose data if something
goes wrong.
@item
-MySQL requires a @code{PRIMARY KEY} in each BDB table to be
+MySQL requires a @code{PRIMARY KEY} in each @code{BDB} table to be
able to refer to previously read rows. If you don't create one,
MySQL will create an maintain a hidden @code{PRIMARY KEY} for
you. The hidden key has a length of 5 bytes and is incremented for each
@@ -40669,25 +41378,26 @@ Internal locking in @code{BDB} tables is done on page level.
@code{SELECT COUNT(*) FROM table_name} is slow as @code{BDB} tables doesn't
maintain a count of the number of rows in the table.
@item
-Scanning is slower than with @code{MyISAM} tables as one has data in BDB
+Scanning is slower than with @code{MyISAM} tables as one has data in
+@code{BDB}
tables stored in B-trees and not in a separate datafile.
@item
The application must always be prepared to handle cases where
any change of a @code{BDB} table may make an automatic rollback and any
read may fail with a deadlock error.
@item
-Keys are not compressed to previous keys as with ISAM or MyISAM
+Keys are not compressed to previous keys as with @code{ISAM} or @code{MyISAM}
tables. In other words, the key information will take a little more
-space in @code{BDB} tables compared to MyISAM tables which don't use
+space in @code{BDB} tables compared to @code{MyISAM} tables which don't use
@code{PACK_KEYS=0}.
@item
-There is often holes in the BDB table to allow you to insert new rows in
-the middle of the key tree. This makes BDB tables somewhat larger than
-MyISAM tables.
+There are often holes in the @code{BDB} table to allow you to insert new rows in
+the middle of the key tree. This makes @code{BDB} tables somewhat larger than
+@code{MyISAM} tables.
@item
The optimiser needs to know an approximation of the number of rows in
the table. MySQL solves this by counting inserts and
-maintaining this in a separate segment in each BDB table. If you don't
+maintaining this in a separate segment in each @code{BDB} table. If you don't
issue a lot of @code{DELETE} or @code{ROLLBACK} statements, this number
should be accurate enough for the MySQL optimiser, but as MySQL
only stores the number on close, it may be incorrect if MySQL dies
@@ -40704,16 +41414,17 @@ wait for enough free disk before continuing.
@node BDB TODO, BDB portability, BDB characteristics, BDB
-@subsection Things we need to fix for BDB in the near future:
+@subsection Things we need to fix for @code{BDB} in the near future:
@itemize @bullet
@item
-It's very slow to open many BDB tables at the same time. If you are
-going to use BDB tables, you should not have a very big table cache
+It's very slow to open many @code{BDB} tables at the same time. If you are
+going to use @code{BDB} tables, you should not have a very big table cache
(like >256) and you should use @code{--no-auto-rehash} with the @code{mysql}
client. We plan to partly fix this in 4.0.
@item
-@code{SHOW TABLE STATUS} doesn't yet provide that much information for BDB
+@code{SHOW TABLE STATUS} doesn't yet provide that much information for
+@code{BDB}
tables.
@item
Optimise performance.
@@ -40725,7 +41436,7 @@ Change to not use page locks at all when we are scanning tables.
@node BDB portability, BDB restrictions, BDB TODO, BDB
@subsection Operating systems supported by @code{BDB}
-If you after having built MySQL with support for BDB tables get
+If you after having built MySQL with support for @code{BDB} tables get
the following error in the log file when you start @code{mysqld}:
@example
@@ -40734,13 +41445,13 @@ Can't init dtabases
@end example
This means that @code{BDB} tables are not supported for your architecture.
-In this case you have to rebuild MySQL without BDB table support.
+In this case you have to rebuild MySQL without @code{BDB} table support.
Note: The following list is not complete; we will update it as we
receive more information about this.
-Currently we know that BDB tables works with the following operating
-system.
+Currently we know that the @code{BDB} handler works with the following
+operating systems:
@itemize @bullet
@item
@@ -40763,28 +41474,29 @@ Max OS X
@end itemize
@node BDB restrictions, BDB errors, BDB portability, BDB
-@subsection Restrictions on BDB Tables
+@subsection Restrictions on @code{BDB} Tables
-Here follows the restrictions you have when using BDB tables:
+Here follows the restrictions you have when using @code{BDB} tables:
@itemize @bullet
@item
-BDB tables store in the .db file the path to the file as it was created
-This was done to be able to detect locks in a multi-user
+@code{BDB} tables store in the @file{.db} file the path to the file as it was
+created.
+(This was done to be able to detect locks in a multi-user
environment that supports symlinks).
-The effect of this is that BDB tables are not movable between directories!
+The effect of this is that @code{BDB} tables are not movable between directories!
@item
-When taking backups of BDB tables, you have to either use
+When taking backups of @code{BDB} tables, you have to either use
@code{mysqldump} or take a backup of all @code{table_name.db} files and
-the BDB log files. The BDB log files are the files in the base data
-directory named @code{log.XXXXXXXXXX} (ten digits);
-The BDB table handler stores unfinished transactions in the log files
+the @code{BDB} log files. The @code{BDB} log files are the files in the base
+data directory named @code{log.XXXXXXXXXX} (ten digits);
+The @code{BDB} table handler stores unfinished transactions in the log files
and requires these to be present when @code{mysqld} starts.
@end itemize
@node BDB errors, , BDB restrictions, BDB
-@subsection Errors That May Occur When Using BDB Tables
+@subsection Errors That May Occur When Using @code{BDB} Tables
@itemize @bullet
@item
@@ -40795,13 +41507,13 @@ starting @code{mysqld}:
bdb: Ignoring log file: .../log.XXXXXXXXXX: unsupported log version #
@end example
it means that the new @code{BDB} version doesn't support the old log
-file format. In this case you have to delete all @code{BDB} log BDB
-from your database directory (the files that has the format
-@code{log.XXXXXXXXXX} ) and restart @code{mysqld}. We would also
+file format. In this case you have to delete all @code{BDB} logs
+from your database directory (the files with names that have the format
+@code{log.XXXXXXXXXX}) and restart @code{mysqld}. We would also
recommend you to do a @code{mysqldump --opt} of your old @code{BDB}
-tables, delete the old table and restore the dump.
+tables, delete the old tables, and restore the dump.
@item
-If you are running in not @code{auto_commit} mode and delete a table you
+If you are not running in auto-commit mode and delete a table you
are using by another thread you may get the following error messages in
the MySQL error file:
@@ -40812,7 +41524,7 @@ the MySQL error file:
@end example
This is not fatal but we don't recommend that you delete tables if you are
-not in @code{auto_commit} mode, until this problem is fixed (the fix is
+not in auto-commit mode, until this problem is fixed (the fix is
not trivial).
@end itemize
@@ -41612,10 +42324,10 @@ through the @code{InConnectionString} argument in the
@item @strong{Parameter} @tab @strong{Default value} @tab @strong{Comment}
@item user @tab ODBC (on Windows) @tab The username used to connect to MySQL.
@item server @tab localhost @tab The hostname of the MySQL server.
-@item database @tab @tab The default database
+@item database @tab @tab The default database.
@item option @tab 0 @tab A integer by which you can specify how @code{MyODBC} should work. See below.
@item port @tab 3306 @tab The TCP/IP port to use if @code{server} is not @code{localhost}.
-@item stmt @tab @tab A statement that will be executed when connection to @code{MySQL}.
+@item stmt @tab @tab A statement that will be executed when connecting to @code{MySQL}.
@item password @tab @tab The password for the @code{server} @code{user} combination.
@item socket @tab @tab The socket or Windows pipe to connect to.
@end multitable
@@ -44343,14 +45055,14 @@ if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
@end example
By using @code{mysql_options()} the MySQL library will read the
-@code{[client]} and @code{your_prog_name} sections in the @file{my.cnf}
+@code{[client]} and @code{[your_prog_name]} sections in the @file{my.cnf}
file which will ensure that your program will work, even if someone has
set up MySQL in some non-standard way.
Note that upon connection, @code{mysql_real_connect()} sets the @code{reconnect}
-flag (part of the MYSQL structure) to a value of @code{1}. This flag indicates,
-in the event that a query cannot be performed because of a lost connection, to
-try reconnecting to the server before giving up.
+flag (part of the @code{MYSQL} structure) to a value of @code{1}. This
+flag indicates, in the event that a query cannot be performed because
+of a lost connection, to try reconnecting to the server before giving up.
@node mysql_real_escape_string, mysql_real_query, mysql_real_connect, C API functions
@@ -44845,7 +45557,7 @@ None.
@subsubheading Description
This function needs to be called for each created thread to initialise
-thread specific variables.
+thread-specific variables.
This is automatically called by @code{my_init()} and @code{mysql_connect()}.
@@ -45235,12 +45947,12 @@ MySQL functions which did not create the connection to the
MySQL database:
When you call @code{mysql_init()} or @code{mysql_connect()}, MySQL will
-create a thread specific variable for the thread that is used by the
+create a thread-specific variable for the thread that is used by the
debug library (among other things).
If you call a MySQL function, before the thread has
called @code{mysql_init()} or @code{mysql_connect()}, the thread will
-not have the necessary thread specific variables in place and you are
+not have the necessary thread-specific variables in place and you are
likely to end up with a core dump sooner or later.
The get things to work smoothly you have to do the following:
@@ -45254,8 +45966,8 @@ Call @code{mysql_thread_init()} in the thread handler before calling
any MySQL function.
@item
In the thread, call @code{mysql_thread_end()} before calling
-@code{pthread_exit()}. This will free the memory used by MySQL thread
-specific variables.
+@code{pthread_exit()}. This will free the memory used by MySQL
+thread-specific variables.
@end enumerate
You may get some errors because of undefined symbols when linking your
@@ -45299,10 +46011,10 @@ functions:
@item @code{mysql_thread_end()} @tab Should be called before calling @code{pthread_exit()}
@end multitable
-Then you must link your code with @code{libmysqld.a} instead of @code{libmysqlclient.a}.
+Then you must link your code with @file{libmysqld.a} instead of @file{libmysqlclient.a}.
The above @code{mysql_server_xxx} functions are also included in
-@code{libmysqlclient.a} to allow you to change between the embedded and the
+@file{libmysqlclient.a} to allow you to change between the embedded and the
client/server version by just linking your application with the right
library. @xref{mysql_server_init}.
@@ -45361,11 +46073,11 @@ embedded. @xref{Option files}.
Put common options in the @code{[server]} section. These will be read by
both MySQL versions.
@item
-Put client/server specific options in the @code{[mysqld]} section.
+Put client/server-specific options in the @code{[mysqld]} section.
@item
-Put embedded MySQL specific options in the @code{[embedded]} section.
+Put embedded MySQL-specific options in the @code{[embedded]} section.
@item
-Put application specific options in a @code{[ApplicationName_SERVER]}
+Put application-specific options in a @code{[ApplicationName_SERVER]}
section.
@end itemize
@@ -46083,7 +46795,7 @@ is not the case, you should run the script
@menu
* UDF calling:: UDF Calling Sequences
-* UDF aggr. calling :: UDF Calling Sequences for aggregate functions
+* UDF aggr. calling::
* UDF arguments:: Argument Processing
* UDF return values:: Return Values and Error Handling
* UDF compiling:: Compiling and Installing User-definable Functions
@@ -46200,7 +46912,7 @@ change! If you need memory, you should allocate it in @code{xxx_init()}
and free it in @code{xxx_deinit()}.
-@node UDF calling, UDF aggr. calling , Adding UDF, Adding UDF
+@node UDF calling, UDF aggr. calling, Adding UDF, Adding UDF
@subsubsection UDF Calling Sequences for simple functions
@cindex calling sequences for simple functions, UDF
@@ -46343,7 +47055,7 @@ into @code{*error}! This is just a 1 byte flag!
If @code{isnull} or @code{error} are set after @code{xxx()} then MySQL
will return @code{NULL} as the result for the group function.
-@node UDF arguments, UDF return values, UDF aggr. calling , Adding UDF
+@node UDF arguments, UDF return values, UDF aggr. calling, Adding UDF
@subsubsection Argument Processing
@cindex argument processing
@@ -46577,7 +47289,8 @@ Copy this file to some directory searched by @code{ld}, such as
@code{LD_LIBRARY_PATH} environment variable to point at the directory where
you have your UDF function files. The @code{dlopen} manual page tells you
which variable you should use on your system. You should set this in
-@code{mysql.server} or @code{safe_mysqld} and restart @code{mysqld}.
+@code{mysql.server} or @code{safe_mysqld} startup scripts and restart
+@code{mysqld}.
After the library is installed, notify @code{mysqld} about the new
functions with these commands:
@@ -47251,7 +47964,7 @@ you have to increase this variable both in the client and in the server.
It's safe to increase this variable as memory is only allocated when
needed; this variable is more a precaution to catch wrong packets
-between the client/server and also to ensure that you don't accidently
+between the client/server and also to ensure that you don't accidentally
use big packets so that you run out of memory.
If you are using the @code{mysql} client, you may specify a bigger
@@ -47504,7 +48217,7 @@ You can check which tables you have in the current database with
@node Cannot initialize character set, Not enough file handles, Cannot find table, Common errors
@appendixsubsec @code{Can't initialize character set xxx} error
-@cindex multibyte character sets
+@cindex multi-byte character sets
If you get an error like:
@@ -47612,7 +48325,7 @@ limits! In this case you should start @code{safe_mysqld} with @code{sh}!
@menu
* Link errors:: Problems When Linking with the MySQL Client Library
* Changing MySQL user:: How to Run MySQL As a Normal User
-* File permissions :: Problems with File Permissions
+* File permissions::
@end menu
@node Link errors, Changing MySQL user, Installation Issues, Installation Issues
@@ -47661,20 +48374,20 @@ latest MySQL source distribution and compile this yourself.
If you are trying to run a program and you then get errors for
unreferenced symbols that start with @code{mysql_} or that the
@code{mysqlclient} library can't be found, this means that your system
-can't find the share @code{libmysqlclient.so} library.
+can't find the share @file{libmysqlclient.so} library.
The fix for this is to tell your system to search after shared
libraries where the library is located by one of the following methods:
@itemize @bullet
@item
-Add the path to the directory where you have @code{libmysqlclient.so} the
+Add the path to the directory where you have @file{libmysqlclient.so} the
@code{LD_LIBRARY_PATH} environment variable.
@item
-Add the path to the directory where you have @code{libmysqlclient.so} the
+Add the path to the directory where you have @file{libmysqlclient.so} the
@code{LD_LIBRARY} environment variable.
@item
-Copy @code{libmysqlclient.so} to some place that is searched by your system,
+Copy @file{libmysqlclient.so} to some place that is searched by your system,
like @file{/lib}, and update the shared library information by executing
@code{ldconfig}.
@end itemize
@@ -47685,7 +48398,7 @@ before linking your code. In the second case you should be
sure that no other programs are using the dynamic libraries!
-@node Changing MySQL user, File permissions , Link errors, Installation Issues
+@node Changing MySQL user, File permissions, Link errors, Installation Issues
@appendixsubsec How to Run MySQL As a Normal User
@cindex starting, @code{mysqld}
@@ -47879,12 +48592,6 @@ check whether things that work for others crash for you. Please try
the following things:
@itemize @bullet
-@item
-Cleaned up @code{NULL} handling for default values in @code{DESCRIBE
-table_name}.
-@item
-Fixed @code{truncate()} to round up negative values to the nearest integer.
-@item
Take down the @code{mysqld} daemon with @code{mysqladmin shutdown}, run
@code{myisamchk --silent --force */*.MYI} on all tables, and restart the
@code{mysqld} daemon. This will ensure that you are running from a clean
@@ -49062,225 +49769,6 @@ By Thomas Thaele @email{tthaele@@papenmeier.de}
@appendixsec Clients
-@itemize @bullet
-@item Graphical clients
-@itemize @minus
-@item @uref{http://www.ideit.com/products/dbvis/}
-DbVisualizer, a freeware JDBC client to graphically visualise
-the data and structure of several databases simultaneously.
-By Innovative-IT Development AB.
-
-@item @uref{http://www.mysql.com/downloads/gui-clients.html}
-MySQLGUI, the MySQL GUI client homepage. By Sinisa at MySQL AB.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysql_navigator_0.9.0.tar.gz}
-MySQL Navigator is a MySQL database server GUI client program, distributed
-under GPL license. The purpose of MySQL Navigator is to provide a useful
-client interface to MySQL database servers, whilst supporting multiple
-operating systems and languages. You can currently import/export database,
-enter queries, get result sets, edit scripts, run scripts, add, alter, and
-delete users, and retrieve client and server information. Uses QT 2.2.
-The homepage for MySQL Navigator is at @uref{http://sql.kldp.org/mysql/}.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/secman.zip}
-A user and security management GUI for MySQL on Windows.
-By Martin Jeremic.
-The homepage for MySQL Security GUI is at @uref{http://jsoft.webjump.com/}.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/kmysqladmin-0.4.1.tar.gz}.
-@item @uref{http://www.mysql.com/Downloads/Contrib/kmysqladmin-0.4.1-1.src.rpm}.
-@item @uref{http://www.mysql.com/Downloads/Contrib/kmysqladmin-0.4.1-1.i386.rpm}
-An administration tool for the MySQL server using QT / KDE. Tested
-only on Linux.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-admin-using-java+swing.tar.gz}
-Java client using Swing, by Fredy Fischer (@email{se-afs@@dial.eunet.ch}).
-You can always find the latest version at
-@uref{http://www.trash.net/~ffischer/admin/}.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/MySQL-Maker-1.0.zip}.
-Shareware MySQL client for Windows. It's a WYSIWYG tool which allows
-you to create, change and delete databases and tables.
-You can change field - structure and add, change and delete data in
-these tables directly without ODBC-driver.
-The MySQL Maker homepage is at @uref{http://www.presult.de/presult/frames/fs_mysqlmaker.html}.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip}
-Windows GUI (binary only) to administrate a database, by David B. Mansel,
-@email{david@@zhadum.org}.
-
-@item @uref{http://home.online.no/~runeberg/myqa/}
-MyQA is a Linux-based query client for the MySQL database server. MyQA
-lets you enter SQL queries, execute them, and view the results, all in a
-graphical user interface. The GUI is roughly similar to that of the
-'Query Analyzer' client that comes with MS SQL Server.
-
-@item @uref{http://www.opex.atnet.ru/mysqlmanager/}
-MySQL Manager is a graphical MySQL server manager for MySQL server
-written in Java.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/netadmin.zip}
-An administrator tool for MySQL on Windows 95/98 and Windows NT
-4.0. Only tested with MySQL Versions 3.23.5 - 3.23.7. Written
-using the Tmysql components.
-
-You can write queries and show tables, indexes, table syntax, and
-administrate user, host, and database and so on. This is beta and
-still has some bugs. You can test the program with all features. Please
-send bugs and hints to Marco Suess @email{ms@@it-netservice.de}. Original
-URL @uref{http://www.it-netservice.de/pages/software/}.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/netadmin2.zip}
-New version of netadmin. See above for details.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/ARTADMIN203.EXE}
-Atronic's MySQL client for Windows 2.0.3.0.
-The home page for this can be found at @uref{http://www.artronic.hr/}.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/W9xstop.zip}
-Utility from Artronic to stop MySQL on win9x.
-
-@item @uref{http://bardo.hyperlink.cz/mysqlmon/}
-A light weight GUI client for Windows.
-
-@item @uref{http://www.mysqlfront.de/}
-MySQLfront is a very nice Windows client with lots of useful features.
-By Angsar Becker.
-
-@item @uref{http://www.dbtools.com.br/}
-Dbtools, a tool to manage MySQL databases. Currently only for Windows.
-Some features:
-@itemize @bullet
-@item Manage servers, databases, tables, columns, indexes, and users
-@item Import wizard to import structure and data from MS Access, MS Excel, Dbase, FoxPro, Paradox, and ODBC Databases.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/KMYENG113.zip}
-An administrator GUI for MySQL. Works only on Windows, no source.
-Available in English and Japanese. By Mitunobu Kaneko.
-Home page: @uref{http://sql.jnts.ne.jp/}
-@end itemize
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/xmysqladmin-1.0.tar.gz}
-An X-based front end to the MySQL database engine. It allows reloads,
-status check, process control, myisamchk, grant/revoke privileges,
-creating databases, dropping databases, create, alter, browse, and drop
-tables. Originally by Gilbert Therrien, @email{gilbert@@ican.net} but
-now in public domain and supported by MySQL AB.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/xmysql-1.9.tar.gz}.
-xmysqlA front end to the MySQL database engine. It allows for simple
-queries and table maintenance, as well as batch queries. By Rick
-Mehalick, @email{dblhack@@wt.net}.
-The xmysql homepage is at @uref{http://web.wt.net/~dblhack/}
-Requires @uref{http://bragg.phys.uwm.edu/xforms/} (xforms 0.88) to work.
-
-@item @uref{http://www.tamos.net/sw/dbMetrix/}
-dbMatrix is an @code{Open Source} client for exploring databases and executing
-SQL. Supports MySQL, Oracle, PostgreSQL, and mSQL.
-
-@item @uref{http://www.multimania.com/bbrox/GtkSQL/}
-GtkSQL is a query tool for MySQL and PostgreSQL.
-
-@item @uref{http://dbman.linux.cz/}
-dbMan is a query tool written in Perl. Uses DBI and Tk.
-
-@item @uref{http://www.mysql.com/Downloads/Win32/Msc201.EXE} (Mascon 202)
-@item @uref{http://www.mysql.com/Downloads/Win32/FrMsc202.EXE} (Free Mascon 202)
-Mascon is a powerful Win32 GUI for the administering MySQL server
-databases. Mascon's features include visual table design, connections to
-multiple servers, data and blob editing of tables, security setting, SQL
-color coding, dump functionality and much more.
-The Mascon homepage is at @uref{http://www.scibit.com/Products/Software/Utils/Mascon.asp}.
-@item @uref{http://www.virtualbeer.net/dbui/}
-DBUI is a Gtk graphical database editor.
-@item @uref{http://www.rtlabs.com/}
-MacSQL is a GUI for MySQL, ODBC, and JDBC databases for the Mac OS.
-@item @uref{http://www.caleb.com.au/}
-JRetriever is a generic database front-end tool for JDBC compliant
-databases written with Java 2. JRetriever displays database
-tables/views in a Windows explorer-like front end. Users can retrieve
-data either by clicking on the table folder or by composing their own SQL
-statements with our built-in SQL editor. The tool has been tested with
-Oracle 8 and MySQL as the back-end databases. It requires JDK 1.3 from
-JavaSoft.
-@item @uref{http://www.jetools.com/products/databrowser/}
-The DataBrowser is a cross-database, cross-platform data access tool. It is more
-user friendly than tools like SQL Plus, psql (command-line based tools). It is more
-flexible than TOAD, ISQL, PGAccess which are GUI's that are limitied to a single
-platform or database.
-@item @uref{http://www.intrex.net/amit/software/}
-The SQL Console is a standalone java application that allows you to connect to a
- SQL database system and issue SQL queries and updates. It has an easy-to use
-graphical user interface. The SQL Console uses JDBC to connect to the database
-systems and, therefore, with proper JDBC drivers, you can use this utility to
-connect to some of the most popular database systems.
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysql_mmc.zip}
-MySQL MMC is a GUI Management Tool developed using kdevelop
-with a very good interface completely like Microsoft
-Enterprise Tool (for SQL Server) or Sybase Central. We
-can use it to manage server, database, table, index,
-users and to edit table data in grid or execute Sql
-by Query Analysis.
-@end itemize
-
-@cindex Web clients
-@item Web Clients
-@itemize @minus
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysqladmin-atif-1.0.tar.gz}
-WWW MySQL administrator for the @code{user,} @code{db} and
-@code{host} tables. By Tim Sailer, modified by Atif Ghaffar
-@email{aghaffar@@artemedia.ch}.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-webadmin-1.0a8-rz.tar.gz}
-A tool written in PHP-FI to administrate MySQL databases
-remotely over the web within a web-browser. By Peter Kuppelwieser,
-@email{peter.kuppelwieser@@kantea.it}. Updated by Wim Bonis,
-@email{bonis@@kiss.de}. Not maintained anymore!
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysqladm.tar.gz}
-MySQL Web Database Administration written in Perl. By Tim Sailer.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysqladm-2.tar.gz}
-Updated version of @file{mysqladm.tar.gz}, by High Tide.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/billowmysql.zip}
-Updated version of @file{mysqladm.tar.gz}, by Ying Gao. You can get the
-newest version from @uref{http://civeng.com/sqldemo/} (the home site).
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/myadmin-0.4.tar.gz}.
-MyAdmin is a web-based MySQL administrator by Mike Machado.
-TheMyAdmin homepage is at @uref{http://myadmin.cheapnet.net/}
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/phpMyAdmin_2.2.0.tar.gz}
-A set of PHP3-scripts to adminstrate MySQL over the WWW.
-
-@item @uref{http://www.phpwizard.net/projects/phpMyAdmin/}
-phpMyAdmin is a PHP3 tool in the spirit of mysql-webadmin, by Tobias Ratschiller, tobias@@dnet.it.
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/useradm.tar.gz}
-MySQL administrator in PHP. By Ofni Thomas
-@email{othomas@@vaidsystems.com}.
-
-@item @uref{http://gossamer-threads.com/perl/mysqlman/mysql.cgi}
-MySQLMan has similar functionality to phpmyadmin, but written with
-Perl and using html templates. By Alex Krohn.
-@end itemize
-
-@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-editor.tar.gz}
-This cgi scripts in Perl enables you to edit content of Mysql
-database. By Tomas Zeman.
-
-@item @uref{http://worldcommunity.com/opensource/futuresql/}
-FutureSQL by Peter F. Brown, is a free, @code{Open Source} rapid application
-development web database administration tool, written in Perl,
-using MySQL. It uses @code{DBI:DBD} and @code{CGI.pm}.
-
-FutureSQL allows one to easily set up config files to view, edit, delete,
-and otherwise process records from a MySQL database. It uses a data
-dictionary, configuration files and templates, and allows "pre-processing"
-and "post-processing" on both fields, records, and operations.
-@end itemize
-
@cindex web tools
@cindex tools,, web
@appendixsec Web Tools
@@ -50323,9 +50811,9 @@ to take down the server.
Improved replication code and features.
@xref{Replication}.
@item
-Numerous new and functions and options.
+Numerous new functions and options.
@item
-Changes to existing code for enhance performance and reliability.
+Changes to existing code for enhanced performance and reliability.
@end itemize
For a full list of changes, please refer to the changelog sections for
@@ -50333,14 +50821,154 @@ each individual 4.0.x release.
@menu
-* News-4.0.3:: Changes in release 4.0.3 (Aug 2002: Beta)
+* News-4.0.5:: Changes in release 4.0.5
+* News-4.0.4:: Changes in release 4.0.4 (29 Sep 2002)
+* News-4.0.3:: Changes in release 4.0.3 (26 Aug 2002: Beta)
* News-4.0.2:: Changes in release 4.0.2 (01 Jul 2002)
* News-4.0.1:: Changes in release 4.0.1 (23 Dec 2001)
* News-4.0.0:: Changes in release 4.0.0 (Oct 2001: Alpha)
@end menu
-@node News-4.0.3, News-4.0.2, News-4.0.x, News-4.0.x
-@appendixsubsec Changes in release 4.0.3 (Aug 2002: Beta)
+@node News-4.0.5, News-4.0.4, News-4.0.x, News-4.0.x
+@appendixsubsec Changes in release 4.0.5
+@itemize
+@item
+Give error if one has more than 2 ^ 32 rows in a MyISAM MERGE file and one
+has not compiled MySQL with @code{-DBIG_TABLES}.
+@item
+Fixed some @code{ORDER BY ... DESC} problems with InnoDB.
+@item
+Fixed an inadvertently changed option (@code{--ignore-space}) back to the
+original @code{--ignore-spaces} in @code{mysqlclient}. (Both syntaxes will
+work).
+@item
+Don't require @code{UPDATE} privilege when using @code{REPLACE}.
+@end itemize
+
+@node News-4.0.4, News-4.0.3, News-4.0.5, News-4.0.x
+@appendixsubsec Changes in release 4.0.4 (29 Sep 2002)
+
+@itemize @bullet
+@item
+Fixed bug where @code{GRANT}/@code{REVOKE} failed if hostname was given in
+not matching case.
+@item
+Don't give warning in @code{LOAD DATA INFILE} when setting a
+@code{timestamp} to a string of '0'.
+@item
+Fixed bug in @code{myisamchk -R} mode.
+@item
+Fixed bug that caused @code{mysqld} to crash on @code{REVOKE}.
+@item
+Fixed bug in @code{ORDER BY} when there is a constant in the @code{SELECT}
+statement.
+@item
+One didn't get an error message if @code{mysqld} couldn't open the
+privilege tables.
+@item
+@code{SET PASSWORD FOR ...} closed the connection in case of errors (bug
+from 4.0.3).
+@item
+Increased max possible @code{max_allowed_packet} in @code{mysqld} to 1GB.
+@item
+Fixed bug when doing a multi-line @code{INSERT} on a table with an
+@code{auto_increment} key which was not in the first part of the key.
+@item
+Changed @code{LOAD DATA INFILE} to not recreate index if the table had
+rows from before.
+@item
+Fixed overrun bug when calling @code{AES_DECRYPT()} with wrong arguments.
+@item
+@code{--skip-ssl} can now be used to disable SSL in the MySQL clients,
+even if one is using other SSL options in an options file or previously
+on the command line.
+@item
+Fixed bug in @code{MATCH ... AGAINST( ... IN BOOLEAN MODE)}
+used with @code{ORDER BY}.
+@item
+Added @code{LOCK TABLES} and @code{CREATE TEMPORARY TABLES} privilege on
+the database level. One must run the @code{mysql_fix_privilege_tables}
+script on old installations to activate these.
+@item
+In @code{SHOW TABLE ... STATUS} compressed tables sometimes showed up as
+@code{dynamic}.
+@item
+@code{SELECT @@@@[global|session].var_name} didn't report
+@code{global | session} in the result column name.
+@item
+Fixed problem in replication that @code{FLUSH LOGS} in a circular
+replication setup created an infinite number of binary log files.
+Now a @code{rotate-binary-log} command in the binary log will not cause slaves
+to rotate logs.
+@item
+Removed @code{STOP EVENT} from binary log when doing @code{FLUSH LOGS}.
+@item
+Disable the use of @code{SHOW NEW MASTER FOR SLAVE} as this needs to be
+completely changed in 4.1.
+@item
+Fixed a bug with constant expression (e.g. field of a one-row table, or field
+from a table, referenced by a @code{UNIQUE} key) appeared in @code{ORDER BY}
+part of @code{SELECT DISTINCT}.
+@item
+@code{--log-binary=a.b.c} now properly strips off @code{.b.c}.
+@item
+@code{FLUSH LOGS} removed numerical extension for all future update logs.
+@item
+@code{GRANT ... REQUIRE} didn't store the SSL information in the
+@code{mysql.user} table if SSL was not enabled in the server.
+@item
+@code{GRANT ... REQUIRE NONE} can now be used to remove SSL information.
+@item
+@code{AND} is now optional between @code{REQUIRE} options.
+@item
+@code{REQUIRE} option was not properly saved, which could cause strange
+output in @code{SHOW GRANTS}.
+@item
+Fixed that @code{mysqld --help} reports correct values for @code{--datadir}
+and @code{--bind-address}.
+@item
+Fixed that one can drop UDFs that didn't exist when mysqld was started.
+@item
+Fixed core dump problem with @code{SHOW VARIABLES} on some 64 bit systems
+(like Solaris sparc).
+@item
+Fixed a bug in my_getopt; @code{--set-variable} syntax didn't work for
+those options that didn't have a valid variable in my_option struct.
+This affected at least @code{default-table-type} option.
+@item
+Fixed a bug from 4.0.2 that caused @code{REPAIR TABLE} and
+@code{myisamchk --repair} to fail on tables with duplicates in a unique
+key.
+@item
+Fixed a bug from 4.0.3 in calculating the default field type for some
+functions. This affected queries of type @code{CREATE TABLE table_name
+SELECT expression(),...}
+@item
+Fixed bug in queries of type
+@code{SELECT * FROM table-list GROUP BY ...} and
+@code{SELECT DISTINCT * FROM ...}.
+@item
+Fixed bug with the @code{--slow-log} when logging an administrator command
+(like @code{FLUSH TABLES}).
+@item
+Fixed a bug that @code{OPTIMIZE} of locked and modified table,
+reported table corruption.
+@item
+Fixed a bug in my_getopt in handling of special prefixes (@code{--skip-},
+@code{--enable-}). @code{--skip-external-locking} didn't work and the bug
+may have affected other similar options.
+@item
+Fixed bug in checking for output file name of the @code{tee} option.
+@item
+Added some more optimisation to use index for
+@code{SELECT ... FROM many_tables .. ORDER BY key limit #}
+@item
+Fixed problem in @code{SHOW OPEN TABLES} when a user didn't have access
+permissions to one of the opened tables.
+@end itemize
+
+@node News-4.0.3, News-4.0.2, News-4.0.4, News-4.0.x
+@appendixsubsec Changes in release 4.0.3 (26 Aug 2002: Beta)
@itemize @bullet
@item
@@ -50442,7 +51070,7 @@ Fixed client hangup bug when using some SQL commands with wrong syntax.
@item
Fixed a timing bug in @code{DROP DATABASE}
@item
-New @code{SET [GLOBAL | SESSION]} syntax to change thread specific and global
+New @code{SET [GLOBAL | SESSION]} syntax to change thread-specific and global
server variables at runtime.
@item
Added variable @code{slave_compressed_protocol}.
@@ -50481,6 +51109,11 @@ other databases. It is synonymous with @code{LOG(X)}.
@itemize @bullet
@item
+Cleaned up @code{NULL} handling for default values in @code{DESCRIBE
+table_name}.
+@item
+Fixed @code{truncate()} to round up negative values to the nearest integer.
+@item
Changed @code{--chroot=path} option to execute @code{chroot()} immediately
after all options have been parsed.
@item
@@ -50634,6 +51267,8 @@ Fixed incorrect error value when doing a @code{SELECT} with an empty
@code{HEAP} table.
@item
Use @code{ORDER BY column DESC} now sorts @code{NULL} values first.
+(In other words, @code{NULL} values sort first in all cases, whether or
+not @code{DESC} is specified.)
@item
Fixed bug in @code{WHERE key_name='constant' ORDER BY key_name DESC}.
@item
@@ -50841,7 +51476,7 @@ Secure connections (with SSL).
Unsigned @code{BIGINT} constants now work. @code{MIN()} and @code{MAX()}
now handle signed and unsigned @code{BIGINT} numbers correctly.
@item
-New character set @code{latin_de} which provides correct German sorting.
+New character set @code{latin1_de} which provides correct German sorting.
@item
@code{STRCMP()} now uses the current character set when doing comparisons,
which means that the default comparison behaviour now is case-insensitive.
@@ -50966,13 +51601,13 @@ MySQL 3.23!
Note that the above doesn't mean that replication or Berkeley DB don't
work. We have done a lot of testing of all code, including replication
-and BDB without finding any problems. It only means that not as many
+and @code{BDB} without finding any problems. It only means that not as many
users use this code as the rest of the code and because of this we are
not yet 100% confident in this code.
@menu
* News-3.23.53:: Changes in release 3.23.53
-* News-3.23.52:: Changes in release 3.23.52
+* News-3.23.52:: Changes in release 3.23.52 (14 Aug 2002)
* News-3.23.51:: Changes in release 3.23.51 (31 May 2002)
* News-3.23.50:: Changes in release 3.23.50 (21 Apr 2002)
* News-3.23.49:: Changes in release 3.23.49
@@ -51032,19 +51667,48 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
+Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}.
+@item
+Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value.
+@item
+Fixed race condition when someone did a @code{GRANT} at the same time a new
+user logged in or did a @code{USE DATABASE}.
+@item
+Fixed bug in @code{ALTER TABLE} and @code{RENAME TABLE} when running with
+@code{-O lower_case_table_names=1} (typically on windows) when giving the
+table name in uppercase.
+@item
+Fixed that @code{-O lower_case_table_names=1} also converts database
+names to lower case.
+@item
+Fixed unlikely core dump with @code{SELECT ... ORDER BY ... LIMIT}.
+@item
+Changed @code{AND/OR} to report that they can return NULL. This fixes a
+bug in @code{GROUP BY} on @code{AND/OR} expressions that return
+@code{NULL}.
+@item
+Fixed a bug that @code{OPTIMIZE} of locked and modified MyISAM table,
+reported table corruption.
+@item
+Fixed a @code{BDB}-related @code{ALTER TABLE} bug with dropping a column
+and shutting down immediately thereafter.
+@item
Fixed problem with @code{configure ... --localstatedir=...}.
@item
Fixed problem with @code{UNSIGNED BIGINT} on AIX (again).
@item
-Fixed bug in pthread_mutex_trylock() on HPUX 11.0
+Fixed bug in pthread_mutex_trylock() on HPUX 11.0.
@item
Multithreaded stress tests for InnoDB.
@end itemize
@node News-3.23.52, News-3.23.51, News-3.23.53, News-3.23.x
-@appendixsubsec Changes in release 3.23.52
+@appendixsubsec Changes in release 3.23.52 (14 Aug 2002)
@itemize @bullet
@item
+Wrap @code{BEGIN}/@code{COMMIT} around transaction in the binary log.
+This makes replication honour transactions.
+@item
Fixed security bug when having an empty database name in the @code{user.db}
table.
@item
@@ -51072,7 +51736,7 @@ Fixed bug with slave net read timeouting
@item
Fixed a core-dump bug with @code{MERGE} tables and @code{MAX()} function.
@item
-Fixed bug in @code{ALTER TABLE} with BDB tables.
+Fixed bug in @code{ALTER TABLE} with @code{BDB} tables.
@item
Fixed bug when logging @code{LOAD DATA INFILE} to binary log with no
active database.
@@ -51115,8 +51779,8 @@ Fixed bug in @code{DROP DATABASE} with symlinked directory.
Fixed optimisation problem with @code{DATETIME} and value outside
@code{DATETIME} range.
@item
-Removed Sleepycat's BDB doc files from the source tree, as they're not
-needed (MySQL covers BDB in its own documentation).
+Removed Sleepycat's @code{BDB} doc files from the source tree, as they're not
+needed (MySQL covers @code{BDB} in its own documentation).
@item
Fixed MIT-pthreads to compile with @code{glibc} 2.2 (needed for
@code{make dist}).
@@ -51146,6 +51810,9 @@ Linux-x86 binaries.
@itemize @bullet
@item
+Fixed buffer overflow problem if someone specified a too long datadir
+parameter to mysqld
+@item
Add missing @code{<row>} tags for @code{mysqldump} XML output.
@item
Fixed problem with @code{crash-me} and @code{gcc} 3.0.4.
@@ -53360,7 +54027,7 @@ Tõnu Samuel).
@item
Fixed optimiser problem on @code{SELECT} when using many overlapping indexes.
MySQL should now be able to choose keys even better when there
-is many keys to choose from.
+are many keys to choose from.
@item
Changed optimiser to prefer a range key instead of a ref key when the
range key can uses more columns than the ref key (which only can use
@@ -55875,7 +56542,8 @@ Added partly-translated Dutch error messages.
@item
Fixed bug in @code{ORDER BY} and @code{GROUP BY} with @code{NULL} columns.
@item
-Added function @code{last_insert_id()} to retrieve last @code{AUTO_INCREMENT}
+Added function @code{LAST_INSERT_ID()} SQL function to retrieve last
+@code{AUTO_INCREMENT}
value. This is intended for clients to ODBC that can't use the
@code{mysql_insert_id()} API function, but can be used by any client.
@item
@@ -57606,25 +58274,25 @@ Instead of using row level locks one can use application level locks
only in well-behaved applications.
In many cases one can do an educated guess which locking type is best
-for the application but generally it's very hard to say that a given
+for the application, but generally it's very hard to say that a given
lock type is better than another; everything depends on the application
and different part of the application may require different lock types.
Here are some tips about locking in MySQL:
-On web application most applications do lots of selects, very few
-deletes, updates mainly on keys and inserts in some specific tables.
+Most web applications do lots of selects, very few
+deletes, updates mainly on keys, and inserts in some specific tables.
The base MySQL setup is very well tuned for this.
-Concurrent users is not a problem if one doesn't mix updates and selects
-that needs to examine many rows in the same table.
+Concurrent users are not a problem if one doesn't mix updates with selects
+that need to examine many rows in the same table.
If one mixes inserts and deletes on the same table then @code{INSERT DELAYED}
may be of great help.
One can also use @code{LOCK TABLES} to speed up things (many updates within
a single lock is much faster than updates without locks). Splitting
-thing to different tables will also helps.
+thing to different tables will also help.
If you get speed problems with the table locks in MySQL, you
may be able to solve these by converting some of your tables to @code{InnoDB}
@@ -57632,7 +58300,7 @@ or @code{BDB} tables.
@xref{InnoDB}. @xref{BDB}.
The optimisation section in the manual covers a lot of different aspects of
-how to tune ones application. @xref{Tips}.
+how to tune applications. @xref{Tips}.
@node RTS-threads, Thread packages, Locking methods, Porting
@@ -57854,7 +58522,7 @@ variables to modify the behaviour of MySQL. @xref{Option files}.
@item @code{DBI_USER} @tab The default user name for Perl DBI.
@item @code{DBI_TRACE} @tab Used when tracing Perl DBI.
@item @code{HOME} @tab The default path for the @code{mysql} history file is @file{$HOME/.mysql_history}.
-@item @code{LD_RUN_PATH} @tab Used to specify where your @code{libmysqlclient.so} is.
+@item @code{LD_RUN_PATH} @tab Used to specify where your @file{libmysqlclient.so} is.
@item @code{MYSQL_DEBUG} @tab Debug-trace options when debugging.
@item @code{MYSQL_HISTFILE} @tab The path to the @code{mysql} history file.
@item @code{MYSQL_HOST} @tab Default host name used by the @code{mysql} command-line client.
diff --git a/VC++Files/bdb/bdb.dsp b/VC++Files/bdb/bdb.dsp
index bed306fc3d0..e8b730f4254 100644
--- a/VC++Files/bdb/bdb.dsp
+++ b/VC++Files/bdb/bdb.dsp
@@ -4,7 +4,7 @@
# TARGTYPE "Win32 (x86) Static Library" 0x0104
-CFG=bdb - Win32 Release
+CFG=bdb - Win32 Max
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,13 +13,12 @@ CFG=bdb - Win32 Release
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "bdb.mak" CFG="bdb - Win32 Release"
+!MESSAGE NMAKE /f "bdb.mak" CFG="bdb - Win32 Max"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "bdb - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "bdb - Win32 Max" (based on "Win32 (x86) Static Library")
-!MESSAGE "bdb - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
@@ -62,8 +61,8 @@ LIB32=link.exe -lib
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "bdb___Win32_Max"
-# PROP Intermediate_Dir "bdb___Win32_Max"
+# PROP Output_Dir "max"
+# PROP Intermediate_Dir "max"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /I "../bdb/build_win32" /I "../bdb/include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /Fr
@@ -77,36 +76,12 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"..\lib_debug\bdb.lib"
# ADD LIB32 /nologo /out:"..\lib_release\bdb.lib"
-!ELSEIF "$(CFG)" == "bdb - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "bdb___Win32_Release"
-# PROP BASE Intermediate_Dir "bdb___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "bdb___Win32_Release"
-# PROP Intermediate_Dir "bdb___Win32_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../bdb/include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"mysys___Win32_Max/" /Fd"mysys___Win32_Max/" /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../bdb/include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"mysys___Win32_Max/" /Fd"mysys___Win32_Max/" /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\lib_release\bdb.lib"
-# ADD LIB32 /nologo /out:"..\lib_release\bdb.lib"
-
!ENDIF
# Begin Target
# Name "bdb - Win32 Debug"
# Name "bdb - Win32 Max"
-# Name "bdb - Win32 Release"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
diff --git a/VC++Files/bdb/build_win32/db_static1.dsp b/VC++Files/bdb/build_win32/db_static1.dsp
new file mode 100644
index 00000000000..771397a455b
--- /dev/null
+++ b/VC++Files/bdb/build_win32/db_static1.dsp
@@ -0,0 +1,85 @@
+# Microsoft Developer Studio Project File - Name="db_static1" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=db_static1 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "db_static1.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "db_static1.mak" CFG="db_static1 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "db_static1 - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "db_static1 - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "db_static1 - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f db_static.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "db_static.exe"
+# PROP BASE Bsc_Name "db_static.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f db_static.mak"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "db_static1.exe"
+# PROP Bsc_Name "db_static1.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "db_static1 - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f db_static.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "db_static.exe"
+# PROP BASE Bsc_Name "db_static.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f db_static.mak"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "db_static1.exe"
+# PROP Bsc_Name "db_static1.bsc"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "db_static1 - Win32 Release"
+# Name "db_static1 - Win32 Debug"
+
+!IF "$(CFG)" == "db_static1 - Win32 Release"
+
+!ELSEIF "$(CFG)" == "db_static1 - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\db_static.dsp
+# End Source File
+# End Target
+# End Project
diff --git a/VC++Files/bdb/build_win32/libdb.def b/VC++Files/bdb/build_win32/libdb.def
new file mode 100644
index 00000000000..a3b4cb3b26b
--- /dev/null
+++ b/VC++Files/bdb/build_win32/libdb.def
@@ -0,0 +1,151 @@
+; $Id: libdb.def,v 11.21 2001/01/04 15:07:33 dda Exp $
+
+DESCRIPTION 'Berkeley DB 3.2 Library'
+EXPORTS
+ lock_get @1
+ lock_id @2
+ lock_put @3
+ lock_vec @4
+ log_compare @5
+ log_file @6
+ log_flush @7
+ log_get @8
+ log_put @9
+ log_register @10
+ log_unregister @11
+ memp_fclose @12
+ memp_fget @13
+ memp_fopen @14
+ memp_fput @15
+ memp_fset @16
+ memp_fsync @17
+ memp_register @18
+ memp_sync @19
+ txn_abort @20
+ txn_begin @21
+ txn_checkpoint @22
+ txn_commit @23
+ txn_prepare @24
+ db_version @25
+ memp_stat @26
+ log_archive @27
+ lock_detect @28
+ txn_id @29
+ txn_stat @30
+ memp_trickle @31
+ log_stat @32
+ lock_stat @33
+ db_create @34
+ db_env_create @35
+ db_strerror @36
+ db_xa_switch @37
+ db_env_set_func_close @38
+ db_env_set_func_dirfree @39
+ db_env_set_func_dirlist @40
+ db_env_set_func_exists @41
+ db_env_set_func_free @42
+ db_env_set_func_fsync @43
+ db_env_set_func_ioinfo @44
+ db_env_set_func_malloc @45
+ db_env_set_func_map @46
+ db_env_set_func_open @47
+ db_env_set_func_read @48
+ db_env_set_func_realloc @49
+ db_env_set_func_rename @50
+ db_env_set_func_sleep @51
+ db_env_set_func_unlink @52
+ db_env_set_func_unmap @53
+ db_env_set_func_write @54
+ db_env_set_func_yield @55
+; FREE @56
+ db_env_set_pageyield @57
+ db_env_set_panicstate @58
+ db_env_set_region_init @59
+ db_env_set_tas_spins @60
+; these are only for testing
+ __db_loadme @201
+ __ham_func2 @202
+ __ham_func3 @203
+ __ham_func4 @204
+ __ham_func5 @205
+ __db_hcreate @206
+ __db_hsearch @207
+ __db_hdestroy @208
+ __db_dbm_init @209
+ __db_dbm_delete @210
+ __db_dbm_fetch @211
+ __db_dbm_store @212
+ __db_dbm_firstkey @213
+ __db_dbm_nextkey @214
+ __db_dbm_close @215
+ __db_ndbm_open @216
+ __db_ndbm_store @217
+ __db_ndbm_rdonly @218
+ __db_ndbm_pagfno @219
+ __db_ndbm_nextkey @220
+ __db_ndbm_firstkey @221
+ __db_ndbm_fetch @222
+ __db_ndbm_error @223
+ __db_ndbm_dirfno @224
+ __db_ndbm_delete @225
+ __db_ndbm_close @226
+ __db_ndbm_clearerr @227
+ __lock_dump_region @228
+ __memp_dump_region @229
+ __os_closehandle @230
+ __os_openhandle @231
+ __os_strdup @232
+ __db_r_attach @233
+ __db_r_detach @234
+ __db_tas_mutex_init @235
+ __db_tas_mutex_lock @236
+ __db_tas_mutex_unlock @237
+ __os_read @238
+ __os_write @239
+ __os_open @240
+ __os_ioinfo @241
+ __os_free @242
+ __os_malloc @243
+ __os_freestr @244
+ __os_calloc @245
+ __ham_test @246
+; these are needed for linking tools
+ __db_dump @401
+ __db_rpath @402
+ __db_dispatch @403
+ __db_err @404
+ __db_init_print @405
+ __txn_init_print @406
+ __log_init_print @407
+ __ham_init_print @408
+ __bam_init_print @409
+ __db_jump @410
+ __ham_pgin @411
+ __ham_pgout @412
+ __bam_pgin @413
+ __bam_pgout @414
+ __db_omode @415
+ __db_prdbt @416
+ __os_sleep @417
+ __db_e_stat @420
+ __db_getlong @421
+ __os_get_errno @422
+ __os_set_errno @423
+ __ham_get_meta @424
+ __ham_release_meta @425
+ __qam_init_print @426
+ __crdel_init_print @427
+ __qam_pgin_out @428
+ __db_pgin @429
+ __db_pgout @430
+ __db_getulong @431
+ __db_util_sigresend @432
+ __db_util_siginit @433
+ __db_util_interrupted @434
+ __db_util_logset @435
+ __db_prheader @436
+ __db_prfooter @437
+ __db_verify_callback @438
+ __db_verify_internal @439
+ __os_yield @440
+ __db_global_values @441
diff --git a/VC++Files/bdb/build_win32/libdb_tcl.def b/VC++Files/bdb/build_win32/libdb_tcl.def
new file mode 100644
index 00000000000..a18459beaba
--- /dev/null
+++ b/VC++Files/bdb/build_win32/libdb_tcl.def
@@ -0,0 +1,35 @@
+; $Id: libdb_tcl.def,v 11.2 1999/11/21 23:10:00 bostic Exp $
+
+DESCRIPTION 'Berkeley DB TCL interface Library'
+EXPORTS
+ Db_tcl_Init
+ bdb_DbmCommand
+ bdb_HCommand
+ bdb_NdbmOpen
+ bdb_RandCommand
+ db_Cmd
+ dbc_Cmd
+ env_Cmd
+ ndbm_Cmd
+ tcl_EnvRemove
+ tcl_LockDetect
+ tcl_LockGet
+ tcl_LockStat
+ tcl_LockVec
+ tcl_LogArchive
+ tcl_LogCompare
+ tcl_LogFile
+ tcl_LogFlush
+ tcl_LogGet
+ tcl_LogPut
+ tcl_LogRegister
+ tcl_LogStat
+ tcl_LogUnregister
+ tcl_Mp
+ tcl_MpStat
+ tcl_MpSync
+ tcl_MpTrickle
+ tcl_Txn
+ tcl_TxnCheckpoint
+ tcl_TxnStat
+ txn_Cmd
diff --git a/VC++Files/client/mysql.dsp b/VC++Files/client/mysql.dsp
index 4c9819bacde..9560a4cfef1 100644
--- a/VC++Files/client/mysql.dsp
+++ b/VC++Files/client/mysql.dsp
@@ -68,7 +68,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -86,6 +87,10 @@ LINK32=link.exe
# Name "mysql - Win32 Debug"
# Begin Source File
+SOURCE=..\mysys\my_gethostbyname.c
+# End Source File
+# Begin Source File
+
SOURCE=.\mysql.cpp
!IF "$(CFG)" == "mysql - Win32 Release"
diff --git a/VC++Files/client/mysqladmin.dsp b/VC++Files/client/mysqladmin.dsp
index 278bcdae8b0..82794da57cb 100644
--- a/VC++Files/client/mysqladmin.dsp
+++ b/VC++Files/client/mysqladmin.dsp
@@ -67,7 +67,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp
index 5e3fbcd060e..4d70971a363 100644
--- a/VC++Files/client/mysqlclient.dsp
+++ b/VC++Files/client/mysqlclient.dsp
@@ -65,7 +65,8 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
@@ -265,6 +266,7 @@ SOURCE=..\mysys\my_alloc.c
# Begin Source File
SOURCE=..\mysys\my_compress.c
+# ADD CPP /I "../zlib"
# End Source File
# Begin Source File
@@ -480,10 +482,6 @@ SOURCE=..\strings\strxmov.c
# End Source File
# Begin Source File
-SOURCE=..\strings\strxnmov.c
-# End Source File
-# Begin Source File
-
SOURCE=..\mysys\thr_mutex.c
# End Source File
# Begin Source File
diff --git a/VC++Files/client/mysqldump.dsp b/VC++Files/client/mysqldump.dsp
index 448ba126153..dcf1c1435a6 100644
--- a/VC++Files/client/mysqldump.dsp
+++ b/VC++Files/client/mysqldump.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -67,7 +67,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/client/mysqlimport.dsp b/VC++Files/client/mysqlimport.dsp
index 5de3b68dd4e..f10c1f90f58 100644
--- a/VC++Files/client/mysqlimport.dsp
+++ b/VC++Files/client/mysqlimport.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -68,7 +68,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/client/mysqlshow.dsp b/VC++Files/client/mysqlshow.dsp
index 329f128d1b6..dd0fc09c70f 100644
--- a/VC++Files/client/mysqlshow.dsp
+++ b/VC++Files/client/mysqlshow.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -67,7 +67,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp
index c3084bfa799..a65f607e738 100644
--- a/VC++Files/innobase/innobase.dsp
+++ b/VC++Files/innobase/innobase.dsp
@@ -4,7 +4,7 @@
# TARGTYPE "Win32 (x86) Static Library" 0x0104
-CFG=innobase - Win32 Max
+CFG=INNOBASE - WIN32 RELEASE
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,10 @@ CFG=innobase - Win32 Max
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "innobase.mak" CFG="innobase - Win32 Max"
+!MESSAGE NMAKE /f "innobase.mak" CFG="INNOBASE - WIN32 RELEASE"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "innobase - Win32 Max" (based on "Win32 (x86) Static Library")
-!MESSAGE "innobase - Win32 Max nt" (based on "Win32 (x86) Static Library")
!MESSAGE "innobase - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "innobase - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE
@@ -30,53 +28,7 @@ CFG=innobase - Win32 Max
CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "innobase - Win32 Max"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "innobase___Win32_Max"
-# PROP BASE Intermediate_Dir "innobase___Win32_Max"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "innobase___Win32_Max"
-# PROP Intermediate_Dir "innobase___Win32_Max"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
-# ADD BASE RSC /l 0x416 /d "NDEBUG"
-# ADD RSC /l 0x416 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\lib_release\innobase-nt.lib"
-# ADD LIB32 /nologo /out:"..\lib_release\innodb.lib"
-
-!ELSEIF "$(CFG)" == "innobase - Win32 Max nt"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "innobase___Win32_Max_nt"
-# PROP BASE Intermediate_Dir "innobase___Win32_Max_nt"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "innobase___Win32_Max_nt"
-# PROP Intermediate_Dir "innobase___Win32_Max_nt"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
-# ADD BASE RSC /l 0x416 /d "NDEBUG"
-# ADD RSC /l 0x416 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\lib_release\innobase-nt.lib"
-# ADD LIB32 /nologo /out:"..\lib_release\innodb-nt.lib"
-
-!ELSEIF "$(CFG)" == "innobase - Win32 Debug"
+!IF "$(CFG)" == "innobase - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -85,8 +37,8 @@ LIB32=link.exe -lib
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "innobase___Win32_Debug"
-# PROP Intermediate_Dir "innobase___Win32_Debug"
+# PROP Output_Dir "debug"
+# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /GX /Z7 /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
@@ -103,13 +55,13 @@ LIB32=link.exe -lib
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "innobase___Win32_Release"
-# PROP BASE Intermediate_Dir "innobase___Win32_Release"
+# PROP BASE Output_Dir "innobase___Win32_Release0"
+# PROP BASE Intermediate_Dir "innobase___Win32_Release0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "innobase___Win32_Release"
-# PROP Intermediate_Dir "innobase___Win32_Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
@@ -126,8 +78,6 @@ LIB32=link.exe -lib
# Begin Target
-# Name "innobase - Win32 Max"
-# Name "innobase - Win32 Max nt"
# Name "innobase - Win32 Debug"
# Name "innobase - Win32 Release"
# Begin Source File
diff --git a/VC++Files/libmysql/libmysql.def b/VC++Files/libmysql/libmysql.def
new file mode 100644
index 00000000000..3ddbe28bc83
--- /dev/null
+++ b/VC++Files/libmysql/libmysql.def
@@ -0,0 +1,118 @@
+LIBRARY LIBMYSQL
+DESCRIPTION 'MySQL 4.0 Client Library'
+VERSION 4.0
+EXPORTS
+ mysql_affected_rows
+ mysql_close
+ mysql_data_seek
+ mysql_debug
+ mysql_dump_debug_info
+ mysql_eof
+ mysql_errno
+ mysql_error
+ mysql_escape_string
+ mysql_fetch_field
+ mysql_fetch_field_direct
+ mysql_fetch_fields
+ mysql_fetch_lengths
+ mysql_fetch_row
+ mysql_field_count
+ mysql_field_seek
+ mysql_field_tell
+ mysql_free_result
+ mysql_get_client_info
+ mysql_get_host_info
+ mysql_get_proto_info
+ mysql_get_server_info
+ mysql_info
+ mysql_init
+ mysql_insert_id
+ mysql_kill
+ mysql_list_dbs
+ mysql_list_fields
+ mysql_list_processes
+ mysql_list_tables
+ mysql_num_fields
+ mysql_num_rows
+ mysql_odbc_escape_string
+ mysql_options
+ mysql_ping
+ mysql_query
+ mysql_real_connect
+ mysql_real_query
+ mysql_refresh
+ mysql_row_seek
+ mysql_row_tell
+ mysql_select_db
+ mysql_shutdown
+ mysql_stat
+ mysql_store_result
+ mysql_thread_id
+ mysql_use_result
+ bmove_upp
+ delete_dynamic
+ _dig_vec
+ init_dynamic_array
+ insert_dynamic
+ int2str
+ is_prefix
+ list_add
+ list_delete
+ max_allowed_packet
+ my_casecmp
+ my_init
+ my_end
+ my_strdup
+ my_malloc
+ my_memdup
+ my_no_flags_free
+ my_realloc
+ my_thread_end
+ my_thread_init
+ net_buffer_length
+ set_dynamic
+ strcend
+ strdup_root
+ strfill
+ strinstr
+ strmake
+ strmov
+ strxmov
+ myodbc_remove_escape
+ mysql_thread_safe
+ mysql_character_set_name
+ mysql_change_user
+ mysql_send_query
+ mysql_read_query_result
+ mysql_real_escape_string
+ mysql_ssl_set
+ mysql_real_connect
+ mysql_master_query
+ mysql_master_send_query
+ mysql_slave_query
+ mysql_slave_send_query
+ mysql_enable_rpl_parse
+ mysql_disable_rpl_parse
+ mysql_rpl_parse_enabled
+ mysql_enable_reads_from_master
+ mysql_disable_reads_from_master
+ mysql_reads_from_master_enabled
+ mysql_rpl_query_type
+ mysql_rpl_probe
+ mysql_set_master
+ mysql_add_slave
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VC++Files/libmysql/libmySQL.dsp b/VC++Files/libmysql/libmysql.dsp
index 14587260d60..4dc0f86a6e9 100644
--- a/VC++Files/libmysql/libmySQL.dsp
+++ b/VC++Files/libmysql/libmysql.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "." /I "..\include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "USE_OLD_FUNCTIONS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "." /I "..\include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
@@ -59,7 +59,7 @@ LINK32=link.exe
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Move DLL export lib
-PostBuild_Cmds=copy release\libmysql.lib ..\lib_release
+PostBuild_Cmds=xcopy release\libmysql.lib ..\lib_release /v
# End Special Build Tool
!ELSEIF "$(CFG)" == "libmySQL - Win32 Debug"
@@ -76,7 +76,8 @@ PostBuild_Cmds=copy release\libmysql.lib ..\lib_release
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "USE_OLD_FUNCTIONS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -91,7 +92,7 @@ LINK32=link.exe
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Move DLL export lib
-PostBuild_Cmds=copy debug\libmysql.lib ..\lib_debug
+PostBuild_Cmds=xcopy ..\lib_debug\libmysql.dll C:\winnt\system32\ /v xcopy debug\libmysql.lib ..\lib_debug\ /v
# End Special Build Tool
!ENDIF
@@ -446,10 +447,6 @@ SOURCE=..\strings\strxmov.c
# End Source File
# Begin Source File
-SOURCE=..\strings\strxnmov.c
-# End Source File
-# Begin Source File
-
SOURCE=..\mysys\thr_mutex.c
# End Source File
# Begin Source File
diff --git a/VC++Files/libmysqld/libmysqld.def b/VC++Files/libmysqld/libmysqld.def
new file mode 100644
index 00000000000..c6615ee971c
--- /dev/null
+++ b/VC++Files/libmysqld/libmysqld.def
@@ -0,0 +1,65 @@
+LIBRARY LIBMYSQLD
+DESCRIPTION 'MySQL 4.0 Embedded Server Library'
+VERSION 4.0
+EXPORTS
+ mysql_server_end
+ mysql_server_init
+ mysql_use_result
+ mysql_thread_safe
+ mysql_thread_id
+ mysql_store_result
+ mysql_stat
+ mysql_shutdown
+ mysql_select_db
+ mysql_row_tell
+ mysql_row_seek
+ mysql_real_query
+ mysql_real_connect
+ mysql_query
+ mysql_ping
+ mysql_options
+ mysql_num_rows
+ mysql_num_fields
+ mysql_list_tables
+ mysql_list_processes
+ mysql_list_fields
+ mysql_list_dbs
+ mysql_kill
+ mysql_insert_id
+ mysql_init
+ mysql_info
+ mysql_get_server_info
+ mysql_get_proto_info
+ mysql_get_host_info
+ mysql_get_client_info
+ mysql_free_result
+ mysql_field_tell
+ mysql_field_count
+ mysql_field_seek
+ mysql_fetch_row
+ mysql_fetch_lengths
+ mysql_fetch_fields
+ mysql_fetch_field_direct
+ mysql_fetch_field
+ mysql_escape_string
+ mysql_real_escape_string
+ mysql_error
+ mysql_errno
+ mysql_eof
+ mysql_dump_debug_info
+ mysql_drop_db
+ mysql_debug
+ mysql_data_seek
+ mysql_create_db
+ mysql_character_set_name
+ mysql_change_user
+ mysql_connect
+ mysql_close
+ mysql_affected_rows
+ mysql_thread_init
+ mysql_thread_end
+ mysql_send_query
+ mysql_read_query_result
+ mysql_refresh
+ mysql_odbc_escape_string
+ myodbc_remove_escape
diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 34574dd4f2f..bd20c75a24e 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /FR /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FR /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "NDEBUG"
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /dll /machine:I386 /out:"../lib_release/libmysqld.dll" /implib:"../lib_release/libmysqld.lib"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /dll /machine:I386 /out:"../lib_release/libmysqld.dll" /implib:"../lib_release/libmysqld.lib"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "libmysqld - Win32 Debug"
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /FD /GZ /c
+# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "_DEBUG"
@@ -80,7 +80,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\merge.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib ..\lib_debug\vio.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBCMTD" /out:"../lib_debug/libmysqld.dll" /implib:"../lib_debug/libmysqld.lib" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\innodb.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib:"LIBCMTD" /out:"../lib_debug/libmysqld.dll" /implib:"../lib_debug/libmysqld.lib" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
@@ -199,10 +199,6 @@ SOURCE=..\sql\key.cpp
# End Source File
# Begin Source File
-SOURCE=.\lib_load.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\lib_sql.cpp
# End Source File
# Begin Source File
@@ -271,6 +267,10 @@ SOURCE=..\sql\repl_failsafe.cpp
# End Source File
# Begin Source File
+SOURCE=..\sql\set_var.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\sql\slave.cpp
# End Source File
# Begin Source File
@@ -324,6 +324,10 @@ SOURCE=..\sql\sql_lex.cpp
# Begin Source File
SOURCE=..\sql\sql_list.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\sql\sql_load.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/libmysqltest/myTest.dsp b/VC++Files/libmysqltest/myTest.dsp
index 74f7b8ae48e..fec250e7a40 100644
--- a/VC++Files/libmysqltest/myTest.dsp
+++ b/VC++Files/libmysqltest/myTest.dsp
@@ -67,7 +67,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "..\include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "..\include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/libmysqltest/mytest.c b/VC++Files/libmysqltest/mytest.c
index 9c6818ecf6c..ceecbb19902 100644
--- a/VC++Files/libmysqltest/mytest.c
+++ b/VC++Files/libmysqltest/mytest.c
@@ -32,7 +32,7 @@ main( int argc, char * argv[] )
{
char szSQL[ 200 ], aszFlds[ 25 ][ 25 ], szDB[ 50 ] ;
- const char *pszT;
+ const char *pszT;
int i, j, k, l, x ;
MYSQL * myData ;
MYSQL_RES * res ;
diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw
index 6a7ec7a57dd..a6c3b4e7334 100644
--- a/VC++Files/mysql.dsw
+++ b/VC++Files/mysql.dsw
@@ -141,9 +141,6 @@ Package=<4>
Project_Dep_Name myisam
End Project Dependency
Begin Project Dependency
- Project_Dep_Name myisammrg
- End Project Dependency
- Begin Project Dependency
Project_Dep_Name mysys
End Project Dependency
Begin Project Dependency
@@ -153,14 +150,11 @@ Package=<4>
Project_Dep_Name strings
End Project Dependency
Begin Project Dependency
- Project_Dep_Name vio
+ Project_Dep_Name myisammrg
End Project Dependency
Begin Project Dependency
Project_Dep_Name zlib
End Project Dependency
- Begin Project Dependency
- Project_Dep_Name merge
- End Project Dependency
}}}
###############################################################################
@@ -444,18 +438,6 @@ Package=<4>
###############################################################################
-Project: "mysqldemb"=".\mysqldemb\mysqldemb.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
Project: "mysqldump"=".\client\mysqldump.dsp" - Package Owner=<4>
Package=<5>
@@ -486,54 +468,6 @@ Package=<4>
###############################################################################
-Project: "mysqlserver"=".\mysqlserver\mysqlserver.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name zlib
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name bdb
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name dbug
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name heap
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name innobase
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name merge
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name myisam
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name myisammrg
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name mysqldemb
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name mysys
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name regex
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name strings
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "mysqlshow"=".\client\mysqlshow.dsp" - Package Owner=<4>
Package=<5>
@@ -690,24 +624,6 @@ Package=<4>
###############################################################################
-Project: "test_libmysqld"=".\libmysqld\examples\test_libmysqld.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libmysqld
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name mysqlclient
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "thr_insert_test"=".\thr_insert_test\thr_insert_test.dsp" - Package Owner=<4>
Package=<5>
diff --git a/VC++Files/mysqlbinlog/mysqlbinlog.dsp b/VC++Files/mysqlbinlog/mysqlbinlog.dsp
index a62253b2a2c..94723b0a127 100644
--- a/VC++Files/mysqlbinlog/mysqlbinlog.dsp
+++ b/VC++Files/mysqlbinlog/mysqlbinlog.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../sql" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -67,7 +67,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -88,7 +88,7 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
-SOURCE=.\mysqlbinlog.cpp
+SOURCE=..\client\mysqlbinlog.cpp
# End Source File
# End Group
# Begin Group "Header Files"
diff --git a/VC++Files/mysqlcheck/mysqlcheck.dsp b/VC++Files/mysqlcheck/mysqlcheck.dsp
index d4b4f5652b7..49c3fc2b702 100644
--- a/VC++Files/mysqlcheck/mysqlcheck.dsp
+++ b/VC++Files/mysqlcheck/mysqlcheck.dsp
@@ -49,7 +49,7 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlcheck.exe" /libpath:"..\lib_release\\"
!ELSEIF "$(CFG)" == "mysqlcheck - Win32 Debug"
@@ -65,15 +65,15 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqlcheck.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ENDIF
diff --git a/VC++Files/mysqlmanager/MySqlManager.dsp b/VC++Files/mysqlmanager/MySqlManager.dsp
index 56e1b4a5bf2..60ee700b00c 100644
--- a/VC++Files/mysqlmanager/MySqlManager.dsp
+++ b/VC++Files/mysqlmanager/MySqlManager.dsp
@@ -71,7 +71,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /Zi /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /Fr /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /o "NUL" /win32
# SUBTRACT MTL /mktyplib203
diff --git a/VC++Files/mysys/mysys.dsp b/VC++Files/mysys/mysys.dsp
index 7a0087b68d6..42213b16cf5 100644
--- a/VC++Files/mysys/mysys.dsp
+++ b/VC++Files/mysys/mysys.dsp
@@ -26,7 +26,7 @@ CFG=mysys - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysys - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_release\mysys.lib"
@@ -66,13 +66,14 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
+# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\mysys.lib"
@@ -85,19 +86,19 @@ LIB32=link.exe -lib
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "mysys___Win32_Max"
-# PROP Intermediate_Dir "mysys___Win32_Max"
+# PROP Output_Dir "max"
+# PROP Intermediate_Dir "max"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo /out:"..\lib_release\mysys.lib"
# ADD LIB32 /nologo /out:"..\lib_release\mysys-max.lib"
@@ -282,6 +283,19 @@ SOURCE=.\my_clock.c
# Begin Source File
SOURCE=.\my_compress.c
+
+!IF "$(CFG)" == "mysys - Win32 Release"
+
+# ADD CPP /I "../zlib"
+
+!ELSEIF "$(CFG)" == "mysys - Win32 Debug"
+
+# ADD CPP /I "../zlib"
+
+!ELSEIF "$(CFG)" == "mysys - Win32 Max"
+
+!ENDIF
+
# End Source File
# Begin Source File
diff --git a/VC++Files/pack_isam/pack_isam.dsp b/VC++Files/pack_isam/pack_isam.dsp
index 036dcd9a2ca..20c832c96d0 100644
--- a/VC++Files/pack_isam/pack_isam.dsp
+++ b/VC++Files/pack_isam/pack_isam.dsp
@@ -66,7 +66,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/perror/perror.dsp b/VC++Files/perror/perror.dsp
index 2b720ace3e7..3e98e5e5ca9 100644
--- a/VC++Files/perror/perror.dsp
+++ b/VC++Files/perror/perror.dsp
@@ -43,7 +43,8 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -70,7 +71,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
+# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
diff --git a/VC++Files/replace/replace.dsp b/VC++Files/replace/replace.dsp
index 54584151418..011b62d08ec 100644
--- a/VC++Files/replace/replace.dsp
+++ b/VC++Files/replace/replace.dsp
@@ -67,7 +67,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40b /d "_DEBUG"
# ADD RSC /l 0x40b /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp
index a84af8adedc..093cfb0d925 100644
--- a/VC++Files/sql/mysqld.dsp
+++ b/VC++Files/sql/mysqld.dsp
@@ -28,7 +28,7 @@ CFG=mysqld - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqld - Win32 Release"
@@ -45,14 +45,14 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-opt.exe"
# SUBTRACT LINK32 /debug
@@ -71,13 +71,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\isam.lib ..\lib_debug\merge.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld.exe" /pdbtype:sept
@@ -91,22 +92,22 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "NT"
-# PROP Intermediate_Dir "NT"
+# PROP Output_Dir "nt"
+# PROP Intermediate_Dir "nt"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /D "DBUG_OFF" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\dbug.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT LINK32 /pdb:none /debug
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
@@ -119,23 +120,23 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "mysqld___Win32_Max_nt"
-# PROP Intermediate_Dir "mysqld___Win32_Max_nt"
+# PROP Output_Dir "max_nt"
+# PROP Intermediate_Dir "max_nt"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT BASE LINK32 /pdb:none /debug
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib ..\lib_release\innodb-nt.lib ..\lib_release\bdb.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-max-nt.exe"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-max-nt.exe"
# SUBTRACT LINK32 /pdb:none /debug
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
@@ -148,20 +149,20 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "mysqld___Win32_Max"
-# PROP Intermediate_Dir "mysqld___Win32_Max"
+# PROP Output_Dir "max"
+# PROP Intermediate_Dir "max"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../client_release/mysqld-opt.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-max.exe"
# SUBTRACT LINK32 /debug
@@ -802,6 +803,10 @@ SOURCE=.\repl_failsafe.cpp
# End Source File
# Begin Source File
+SOURCE=.\set_var.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\slave.cpp
# End Source File
# Begin Source File
@@ -1162,10 +1167,6 @@ SOURCE=.\sql_test.cpp
# End Source File
# Begin Source File
-SOURCE=.\sql_udf.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\sql_union.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/test1/test1.dsp b/VC++Files/test1/test1.dsp
index ffa5fd4d7ed..50a165e3e4d 100644
--- a/VC++Files/test1/test1.dsp
+++ b/VC++Files/test1/test1.dsp
@@ -67,7 +67,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/thr_insert_test/thr_insert_test.dsp b/VC++Files/thr_insert_test/thr_insert_test.dsp
index 91274e6817a..770125ab65b 100644
--- a/VC++Files/thr_insert_test/thr_insert_test.dsp
+++ b/VC++Files/thr_insert_test/thr_insert_test.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
diff --git a/VC++Files/thr_test/thr_test.dsp b/VC++Files/thr_test/thr_test.dsp
index 495d7280808..7256f8da2fa 100644
--- a/VC++Files/thr_test/thr_test.dsp
+++ b/VC++Files/thr_test/thr_test.dsp
@@ -68,7 +68,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x40b /d "_DEBUG"
# ADD RSC /l 0x40b /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/vio/vio.dsp b/VC++Files/vio/vio.dsp
index 7c6ecb47e5d..d4b77aad391 100644
--- a/VC++Files/vio/vio.dsp
+++ b/VC++Files/vio/vio.dsp
@@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/acinclude.m4 b/acinclude.m4
index 2b6c8cbc390..72b50bcc18f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -701,13 +701,13 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
])
AC_DEFUN(MYSQL_FIND_OPENSSL, [
- for d in /usr/ssl/include /usr/local/ssl/include /usr/include/openssl \
+ for d in /usr/ssl/include /usr/local/ssl/include /usr/include \
/usr/include/ssl /opt/ssl/include /opt/openssl/include \
-/usr/local/ssl/include/openssl /usr/local/include/openssl ; do
- if test -f $d/ssl.h ; then
- OPENSSL_INCLUDE=$d
- fi
- done
+/usr/local/ssl/include /usr/local/include ; do
+ if test -f $d/openssl/ssl.h ; then
+ OPENSSL_INCLUDE=$d
+ fi
+ done
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
/usr/lib /opt/ssl/lib /opt/openssl/lib /usr/local/lib/ ; do
@@ -800,7 +800,7 @@ dnl get substituted.
AC_DEFUN(MYSQL_CHECK_ORBIT, [
AC_MSG_CHECKING(for ORBit)
orbit_config_path=`which orbit-config`
-if test -n "$orbit_config_path"
+if test -n "$orbit_config_path" -a $? = 0
then
orbit_exec_prefix=`orbit-config --exec-prefix`
orbit_includes=`orbit-config --cflags server`
diff --git a/client/Makefile.am b/client/Makefile.am
index cccb612af98..9c994814714 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -16,9 +16,9 @@
# This file is public domain and comes with NO WARRANTY of any kind
-INCLUDES = -I$(srcdir)/../include $(openssl_includes) \
+INCLUDES = -I$(srcdir)/../include \
-I../include -I$(srcdir)/.. -I$(top_srcdir) \
- -I..
+ -I.. $(openssl_includes)
LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
diff --git a/client/mysql.cc b/client/mysql.cc
index 223d4b794d2..7341132b8e0 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
-const char *VER= "12.13";
+const char *VER= "13.0";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@@ -474,10 +474,11 @@ static struct my_option my_long_options[] =
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
(gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
- {"ignore-space", 'i', "Ignore space after function names.", 0, 0, 0,
+ {"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
- 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ (gptr*) &opt_local_infile,
+ (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host,
@@ -610,7 +611,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_LOCAL_INFILE:
using_opt_local_infile=1;
- opt_local_infile= test(!argument || atoi(argument)>0);
break;
case OPT_TEE:
if (argument == disabled_my_option)
@@ -702,6 +702,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
#endif
break;
+#include <sslopt-case.h>
case 'V':
usage(1);
exit(0);
@@ -1321,11 +1322,13 @@ com_help (String *buffer __attribute__((unused)),
{
reg1 int i;
- put_info("\nFull documentation of MySQL is available at\nhttp://www.mysql.com/documentation/mysql/bychapter/\n", INFO_INFO);
- put_info("For technical support contracts, visit https://order.mysql.com/\n", INFO_INFO);
- put_info("MySQL commands:",INFO_INFO);
+ put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
+ put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
+ put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
+ put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
- put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
+ put_info(" (Commands must appear first on line and end with ';')\n",
+ INFO_INFO);
for (i = 0; commands[i].name; i++)
{
if (commands[i].func)
@@ -2225,9 +2228,6 @@ sql_real_connect(char *host,char *database,char *user,char *password,
if (using_opt_local_infile)
mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile);
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index cdca59574f7..01e36509c30 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -52,7 +52,7 @@ static uint ex_val_max_len[MAX_MYSQL_VAR];
static my_bool ex_status_printed = 0; /* First output is not relative. */
static uint ex_var_count, max_var_length, max_val_length;
-#include "sslopt-vars.h"
+#include <sslopt-vars.h>
static void print_version(void);
static void usage(void);
@@ -150,7 +150,7 @@ static struct my_option my_long_options[] =
{"sleep", 'i', "Execute commands again and again with a sleep between.",
(gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
-#include "sslopt-longopts.h"
+#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &user,
(gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -211,6 +211,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '#':
DBUG_PUSH(argument ? argument : "d:t:o,/tmp/mysqladmin.trace");
break;
+#include <sslopt-case.h>
case 'V':
print_version();
exit(0);
@@ -279,9 +280,6 @@ int main(int argc,char *argv[])
mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT, (char*) &tmp);
}
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 4109fbd76d4..b2100ac1596 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2001 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
@@ -21,7 +21,7 @@
#include "log_event.h"
#define BIN_LOG_HEADER_SIZE 4
-#define PROBE_HEADER_LEN (BIN_LOG_HEADER_SIZE+EVENT_LEN_OFFSET+4)
+#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
@@ -40,7 +40,7 @@ static FILE *result_file;
static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
#endif
-void sql_print_error(const char *format,...);
+void sql_print_error(const char *format, ...);
static bool one_database = 0;
static const char* database;
@@ -138,7 +138,7 @@ This software comes with NO WARRANTY: This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n");
printf("\
-Dumps a MySQL binary log in a format usable for viewing or for pipeing to\n\
+Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
the mysql command line client\n\n");
printf("Usage: %s [options] log-files\n", my_progname);
my_print_help(my_long_options);
@@ -378,31 +378,41 @@ static void dump_remote_log_entries(const char* logname)
static int check_header(IO_CACHE* file)
{
+ byte header[BIN_LOG_HEADER_SIZE];
byte buf[PROBE_HEADER_LEN];
int old_format=0;
my_off_t pos = my_b_tell(file);
my_b_seek(file, (my_off_t)0);
- if (my_b_read(file, buf, sizeof(buf)))
- die("Failed reading header");
- if (buf[EVENT_TYPE_OFFSET+4] == START_EVENT)
+ if (my_b_read(file, header, sizeof(header)))
+ die("Failed reading header; Probably an empty file");
+ if (memcmp(header, BINLOG_MAGIC, sizeof(header)))
+ die("File is not a binary log file");
+ if (!my_b_read(file, buf, sizeof(buf)))
{
- uint event_len;
- event_len = uint4korr(buf + EVENT_LEN_OFFSET + 4);
- old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
+ if (buf[4] == START_EVENT)
+ {
+ uint event_len;
+ event_len = uint4korr(buf + 4);
+ old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
+ }
}
my_b_seek(file, pos);
return old_format;
}
+
static void dump_local_log_entries(const char* logname)
{
File fd = -1;
IO_CACHE cache,*file= &cache;
ulonglong rec_count = 0;
- char last_db[FN_REFLEN+1] = "";
+ char last_db[FN_REFLEN+1];
+ byte tmp_buff[BIN_LOG_HEADER_SIZE];
bool old_format = 0;
+ last_db[0]=0;
+
if (logname && logname[0] != '-')
{
if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
@@ -435,14 +445,7 @@ static void dump_local_log_entries(const char* logname)
}
if (!position)
- {
- char magic[BIN_LOG_HEADER_SIZE];
- if (my_b_read(file, (byte*) magic, sizeof(magic)))
- die("I/O error reading binlog magic number");
- if (memcmp(magic, BINLOG_MAGIC, 4))
- die("Bad magic number; The file is probably not a MySQL binary log");
- }
-
+ my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE); // Skip header
for (;;)
{
char llbuff[21];
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index fdc7b5cf4d7..394555f37a9 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -16,13 +16,13 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
-#define CHECK_VERSION "2.4"
+#define CHECK_VERSION "2.4.1"
#include "client_priv.h"
#include <m_ctype.h>
-#include "mysql_version.h"
-#include "mysqld_error.h"
-#include "sslopt-vars.h"
+#include <mysql_version.h>
+#include <mysqld_error.h>
+#include <sslopt-vars.h>
/* Exit codes */
@@ -53,7 +53,7 @@ static struct my_option my_long_options[] =
{"analyze", 'a', "Analyze given tables.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"all-in-1", '1',
- "Instead of making one query for each table, execute all queries in 1 query separately for each database. Table names will be in a comma separeted list.",
+ "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
(gptr*) &opt_all_in_1, (gptr*) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"auto-repair", OPT_AUTO_REPAIR,
@@ -80,14 +80,14 @@ static struct my_option my_long_options[] =
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"fast",'F', "Check only tables that hasn't been closed properly",
+ {"fast",'F', "Check only tables that haven't been closed properly",
(gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an sql-error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"extended", 'e',
- "If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will run an extended repair on the table, which may not only take a long time to execute, but may produce a lot of garbage rows also!",
+ "If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
(gptr*) &opt_extended, (gptr*) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
@@ -121,7 +121,7 @@ static struct my_option my_long_options[] =
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#include "sslopt-longopts.h"
+#include <sslopt-longopts.h>
{"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
@@ -169,7 +169,7 @@ static void usage(void)
puts("and you are welcome to modify and redistribute it under the GPL license.\n");
puts("This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a)");
puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
- puts("used same time. It works on MyISAM and in some cases on BDB tables.");
+ puts("used at the same time. It works on MyISAM and in some cases on BDB tables.");
puts("Please consult the MySQL manual for latest information about the");
puts("above. The options -c,-r,-a and -o are exclusive to each other, which");
puts("means that the last option will be used, if several was specified.\n");
@@ -239,6 +239,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
break;
+#include <sslopt-case.h>
case OPT_TABLES:
opt_databases = 0;
break;
@@ -529,9 +530,6 @@ static int dbConnect(char *host, char *user, char *passwd)
if (opt_compress)
mysql_options(&mysql_connection, MYSQL_OPT_COMPRESS, NullS);
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index fa456320028..21358272109 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -36,7 +36,7 @@
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
*/
-#define DUMP_VERSION "9.06"
+#define DUMP_VERSION "9.07"
#include <my_global.h>
#include <my_sys.h>
@@ -88,7 +88,7 @@ static my_string opt_mysql_unix_port=0;
static int first_error=0;
extern ulong net_buffer_length;
static DYNAMIC_STRING extended_row;
-#include "sslopt-vars.h"
+#include <sslopt-vars.h>
FILE *md_result_file;
static struct my_option my_long_options[] =
@@ -211,7 +211,7 @@ static struct my_option my_long_options[] =
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#include "sslopt-longopts.h"
+#include <sslopt-longopts.h>
{"tab",'T',
"Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if mysqldump is run on the same machine as the mysqld daemon.",
(gptr*) &path, (gptr*) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -232,7 +232,7 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
(gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0,
- GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, 512*1024L*1024L,
+ GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, 1024*1024L*1024L,
MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
(gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0,
@@ -263,22 +263,34 @@ static void print_version(void)
} /* print_version */
+static void short_usage_sub(void)
+{
+ printf("Usage: %s [OPTIONS] database [tables]\n", my_progname);
+ printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
+ my_progname);
+ printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname);
+}
+
static void usage(void)
{
print_version();
puts("By Igor Romanenko, Monty, Jani & Sinisa");
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
puts("Dumping definition and data mysql database or table");
- printf("Usage: %s [OPTIONS] database [tables]\n", my_progname);
- printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
- my_progname);
- printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname);
+ short_usage_sub();
print_defaults("my",load_default_groups);
my_print_help(my_long_options);
my_print_variables(my_long_options);
} /* usage */
+static void short_usage(void)
+{
+ short_usage_sub();
+ printf("For more options, use %s --help\n", my_progname);
+}
+
+
static void write_header(FILE *sql_file, char *db_name)
{
if (opt_xml)
@@ -335,6 +347,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
break;
+#include <sslopt-case.h>
case 'V': print_version(); exit(0);
case 'X':
opt_xml = 1;
@@ -407,7 +420,7 @@ static int get_options(int *argc, char ***argv)
}
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
{
- usage();
+ short_usage();
return 1;
}
if (tty_password)
@@ -457,9 +470,6 @@ static int dbConnect(char *host, char *user,char *passwd)
if (opt_compress)
mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS);
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 603e9036106..a11b7383517 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -47,7 +47,7 @@ static char *opt_password=0, *current_user=0,
static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static my_string opt_ignore_lines=0;
-#include "sslopt-vars.h"
+#include <sslopt-vars.h>
static struct my_option my_long_options[] =
{
@@ -119,7 +119,7 @@ static struct my_option my_long_options[] =
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#include "sslopt-longopts.h"
+#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -188,6 +188,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
break;
+#include <sslopt-case.h>
case 'V': print_version(); exit(0);
case 'I':
case '?':
@@ -347,9 +348,6 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd)
mysql_options(&mysql_connection,MYSQL_OPT_LOCAL_INFILE,
(char*) &opt_local_file);
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 718716b60be..5475fc7b531 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -18,16 +18,14 @@
#define SHOW_VERSION "9.4"
-#include <my_global.h>
#include "client_priv.h"
#include <my_sys.h>
#include <m_string.h>
-#include "mysql.h"
-#include "mysql_version.h"
-#include "mysqld_error.h"
+#include <mysql.h>
+#include <mysqld_error.h>
#include <signal.h>
#include <stdarg.h>
-#include "sslopt-vars.h"
+#include <sslopt-vars.h>
static my_string host=0,opt_password=0,user=0;
static my_bool opt_show_keys=0,opt_compress=0,opt_status=0, tty_password=0;
@@ -85,9 +83,6 @@ int main(int argc, char **argv)
if (opt_compress)
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
@@ -156,7 +151,7 @@ static struct my_option my_long_options[] =
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#include "sslopt-longopts.h"
+#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &user,
(gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -224,6 +219,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
break;
+#include <sslopt-case.h>
case 'V':
print_version();
exit(0);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 181a7fb2b8f..036130f2d80 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -87,11 +87,8 @@
#define CON_RETRY_SLEEP 2
#define MAX_CON_TRIES 5
-#ifndef OS2
#define SLAVE_POLL_INTERVAL 300000 /* 0.3 of a sec */
-#else
-#defile SLAVE_POLL_INTERVAL 0.3
-#endif
+
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
@@ -185,7 +182,9 @@ Q_LET, Q_ECHO,
Q_WHILE, Q_END_BLOCK,
Q_SYSTEM, Q_RESULT,
Q_REQUIRE, Q_SAVE_MASTER_POS,
-Q_SYNC_WITH_MASTER, Q_ERROR,
+Q_SYNC_WITH_MASTER,
+Q_SYNC_SLAVE_WITH_MASTER,
+Q_ERROR,
Q_SEND, Q_REAP,
Q_DIRTY_CLOSE, Q_REPLACE,
Q_PING, Q_EVAL,
@@ -233,6 +232,7 @@ const char *command_names[]=
"require",
"save_master_pos",
"sync_with_master",
+ "sync_slave_with_master",
"error",
"send",
"reap",
@@ -420,6 +420,7 @@ static void free_used_memory()
my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
delete_dynamic(&q_lines);
dynstr_free(&ds_res);
+ free_replace();
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv);
mysql_server_end();
@@ -684,13 +685,23 @@ int open_file(const char* name)
return 0;
}
+static void my_sleep(ulong m_seconds)
+{
+#ifndef OS2
+ struct timeval t;
+ t.tv_sec= m_seconds / 1000000L;
+ t.tv_usec= m_seconds % 1000000L;
+ select(0,0,0,0,&t); /* sleep */
+#else
+ DosSleep(m_seconds/1000+1);
+#endif
+}
+
+
/* ugly long name, but we are following the convention */
int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
{
MYSQL* mysql = &cur_con->mysql;
-#ifndef OS2
- struct timeval t;
-#endif
for (;;)
{
MYSQL_RES* res;
@@ -711,15 +722,8 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
mysql_free_result(res);
if (done)
break;
-#ifndef OS2
- t.tv_sec=0;
- t.tv_usec=SLAVE_POLL_INTERVAL;
- select(0,0,0,0,&t); /* sleep */
-#else
- DosSleep(OS2_SLAVE_POLL_INTERVAL);
-#endif
+ my_sleep(SLAVE_POLL_INTERVAL);
}
-
return 0;
}
@@ -966,14 +970,13 @@ int do_echo(struct st_query* q)
}
-int do_sync_with_master(struct st_query* q)
+int do_sync_with_master2(const char* p)
{
MYSQL_RES* res;
MYSQL_ROW row;
MYSQL* mysql = &cur_con->mysql;
char query_buf[FN_REFLEN+128];
int offset = 0;
- char* p = q->first_argument;
int rpl_parse;
if (!master_pos.file[0])
@@ -998,13 +1001,25 @@ int do_sync_with_master(struct st_query* q)
die("line %u: empty result in %s", start_lineno, query_buf);
if (!row[0])
die("Error on slave while syncing with master");
- mysql_free_result(res); last_result=0;
+ mysql_free_result(res);
+ last_result=0;
if (rpl_parse)
mysql_enable_rpl_parse(mysql);
+#ifndef TO_BE_REMOVED
+ /*
+ We need this because wait_for_pos() only waits for the relay log,
+ which doesn't guarantee that the slave has executed the statement.
+ */
+ my_sleep(2*1000000L);
+#endif
return 0;
}
+int do_sync_with_master(struct st_query* q)
+{
+ return do_sync_with_master2(q->first_argument);
+}
int do_save_master_pos()
{
@@ -1076,53 +1091,15 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused)))
int do_sleep(struct st_query* q, my_bool real_sleep)
{
char *p=q->first_argument;
- struct timeval t;
- int dec_mul = 1000000;
while (*p && my_isspace(system_charset_info,*p))
p++;
if (!*p)
die("Missing argument in sleep\n");
- t.tv_usec = 0;
-
-#ifdef OS2
-
if (opt_sleep && !real_sleep)
- DosSleep( opt_sleep * 1000);
+ my_sleep(opt_sleep * 1000000L);
else
- DosSleep( atof( p) * 1000);
+ my_sleep((ulong) (atof(p) * 1000000L));
return 0;
-
-#else
- if (opt_sleep && !real_sleep)
- t.tv_sec = opt_sleep;
- else
- {
- t.tv_sec = atoi(p);
- while (*p && *p != '.' && !my_isspace(system_charset_info,*p))
- p++;
- if (*p == '.')
- {
- int c;
- char *p_end;
- p++;
- p_end = p + 6;
-
- for (;p <= p_end; ++p)
- {
- c = (int) (*p - '0');
- if (c < 10 && (int) c >= 0)
- {
- t.tv_usec = t.tv_usec * 10 + c;
- dec_mul /= 10;
- }
- else
- break;
- }
- }
- }
- t.tv_usec *= dec_mul;
- return select(0,0,0,0, &t);
-#endif
}
static void get_file_name(char *filename, struct st_query* q)
@@ -1255,8 +1232,7 @@ static void get_replace(struct st_query *q)
POINTER_ARRAY to_array,from_array;
DBUG_ENTER("get_replace");
- if (glob_replace)
- free_replace();
+ free_replace();
bzero((char*) &to_array,sizeof(to_array));
bzero((char*) &from_array,sizeof(from_array));
@@ -1292,16 +1268,18 @@ static void get_replace(struct st_query *q)
void free_replace()
{
DBUG_ENTER("free_replace");
- my_free((char*) glob_replace,MYF(0));
- glob_replace=0;
- free_replace_buffer();
+ if (glob_replace)
+ {
+ my_free((char*) glob_replace,MYF(0));
+ glob_replace=0;
+ free_replace_buffer();
+ }
DBUG_VOID_RETURN;
}
-
-int select_connection(struct st_query* q)
+int select_connection(char *p)
{
- char* p=q->first_argument, *name;
+ char* name;
struct connection *con;
DBUG_ENTER("select_connection");
DBUG_PRINT("enter",("name: '%s'",p));
@@ -2102,7 +2080,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
char* query;
int query_len;
DBUG_ENTER("run_query");
-
+
if (q->type != Q_EVAL)
{
query = q->query;
@@ -2115,6 +2093,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
query = eval_query.str;
query_len = eval_query.length;
}
+ DBUG_PRINT("enter", ("query: '%-.60s'", query));
if (q->record_file[0])
{
@@ -2426,7 +2405,7 @@ int main(int argc, char** argv)
processed = 1;
switch (q->type) {
case Q_CONNECT: do_connect(q); break;
- case Q_CONNECTION: select_connection(q); break;
+ case Q_CONNECTION: select_connection(q->first_argument); break;
case Q_DISCONNECT:
case Q_DIRTY_CLOSE:
close_connection(q); break;
@@ -2515,6 +2494,19 @@ int main(int argc, char** argv)
break;
case Q_SAVE_MASTER_POS: do_save_master_pos(); break;
case Q_SYNC_WITH_MASTER: do_sync_with_master(q); break;
+ case Q_SYNC_SLAVE_WITH_MASTER:
+ {
+ do_save_master_pos();
+ if (*q->first_argument)
+ select_connection(q->first_argument);
+ else
+ {
+ char buf[] = "slave";
+ select_connection(buf);
+ }
+ do_sync_with_master2("");
+ break;
+ }
case Q_COMMENT: /* Ignore row */
case Q_COMMENT_WITH_COMMAND:
case Q_PING:
diff --git a/configure.in b/configure.in
index 8ca1a0befed..51737f969a3 100644
--- a/configure.in
+++ b/configure.in
@@ -453,6 +453,9 @@ fi
NOINST_LDFLAGS=
+static_nss=""
+STATIC_NSS_FLAGS=""
+OTHER_LIBC_LIB=""
AC_ARG_WITH(other-libc,
[ --with-other-libc=DIR Link against libc and other standard libraries
installed in the specified non-standard location
@@ -472,13 +475,13 @@ AC_ARG_WITH(other-libc,
# by telling it to be permissive. Note that this option only works with
# new versions of gcc (2.95.x and above)
CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include"
- static_nss=
if test -f "$other_libc_lib/libnss_files.a"
then
# libc has been compiled with --enable-static-nss
# we need special flags, but we will have to add those later
- STATIC_NSS_FLAGS="-Wl,--start-group -lc -lnss_files -lnss_dns -lresolv \
- -Wl,--end-group"
+ STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
+ STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
+ OTHER_LIBC_LIB="-static -L$other_libc_lib"
static_nss=1
else
# this is a dirty hack. We if we detect static nss glibc in the special
@@ -507,6 +510,23 @@ AC_ARG_WITH(other-libc,
)
AC_SUBST(NOINST_LDFLAGS)
+#
+# Check if we are using Linux and a glibc compiled with static nss
+# (this is true on the MySQL build machines to avoid NSS problems)
+#
+
+if test "$IS_LINUX" = "true" -a "$static_nss" = ""
+then
+ tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
+ if test -n "$tmp"
+ then
+ STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
+ STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
+ static_nss=1
+ fi
+fi
+
+
AC_ARG_WITH(server-suffix,
[ --with-server-suffix Append value to the version string.],
[ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ],
@@ -925,7 +945,7 @@ case $SYSTEM_TYPE in
fi
fi
;;
- *darwin*)
+ *darwin5*)
if test "$ac_cv_prog_gcc" = "yes"
then
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
@@ -934,6 +954,14 @@ case $SYSTEM_TYPE in
with_named_curses=""
fi
;;
+ *darwin6*)
+ if test "$ac_cv_prog_gcc" = "yes"
+ then
+ CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
+ CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
+ MAX_C_OPTIMIZE="-O"
+ fi
+ ;;
*freebsd*)
echo "Adding fix for interrupted reads"
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
@@ -1387,7 +1415,7 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
fi
-# Force static compilation to avoid linking probles/get more speed
+# Force static compilation to avoid linking problems/get more speed
AC_ARG_WITH(mysqld-ldflags,
[ --with-mysqld-ldflags Extra linking arguments for mysqld],
[MYSQLD_EXTRA_LDFLAGS=$withval],
@@ -2164,10 +2192,7 @@ then
AC_DEFINE(THREAD_SAFE_CLIENT)
fi
-if test "$static_nss" = "1"
-then
- CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS"
-fi
+CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS"
AC_SUBST(CLIENT_LIBS)
AC_SUBST(sql_client_dirs)
@@ -2314,11 +2339,8 @@ fi
# I know to add the static NSS magic if we have static NSS libraries with
# glibc - Sasha
-if test "$static_nss" = "1"
-then
- LDFLAGS="$LDFLAGS -static -L$other_libc_lib "
- LIBS="$LIBS $STATIC_NSS_FLAGS"
-fi
+LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
+LIBS="$LIBS $STATIC_NSS_FLAGS"
AC_SUBST(sql_server_dirs)
AC_SUBST(thread_dirs)
diff --git a/include/Makefile.am b/include/Makefile.am
index a3aebfa70e0..2df8b46d369 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -19,15 +19,15 @@ BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h
pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \
mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
- errmsg.h my_global.h my_net.h my_alloc.h\
- sslopt-longopts.h sslopt-usage.h \
- sslopt-vars.h $(BUILT_SOURCES)
+ errmsg.h my_global.h my_net.h my_alloc.h \
+ my_getopt.h sslopt-longopts.h \
+ sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h \
nisam.h heap.h merge.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\
my_dir.h mysys_err.h my_base.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
- my_aes.h my_getopt.h my_tree.h hash.h thr_alarm.h \
+ my_aes.h my_tree.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h md5.h \
mysql_version.h.in my_handler.h
diff --git a/include/config-win.h b/include/config-win.h
index c0d0dad894e..5bdede86a9e 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -259,6 +259,8 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_ISNAN
#define HAVE_FINITE
#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */
+#define HAVE_QUERY_CACHE
+#define SPRINTF_RETURNS_INT
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
diff --git a/include/my_base.h b/include/my_base.h
index 22bc3355cd5..0158f735cc0 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -107,6 +107,7 @@ enum ha_extra_function {
HA_EXTRA_NO_IGNORE_DUP_KEY,
HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE, /* Cursor will not be used for update */
HA_EXTRA_BULK_INSERT_BEGIN,
+ HA_EXTRA_BULK_INSERT_FLUSH, /* Flush one index */
HA_EXTRA_BULK_INSERT_END,
HA_EXTRA_PREPARE_FOR_DELETE
};
diff --git a/include/my_global.h b/include/my_global.h
index e65e803c335..8524328a47b 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1016,7 +1016,7 @@ typedef union {
#ifdef SPRINTF_RETURNS_PTR
#define my_sprintf(buff,args) ((int)(sprintf args - buff))
#else
-#define my_sprintf(buff,args) sprintf args,strlen(buff)
+#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
#endif
#endif
diff --git a/include/my_sys.h b/include/my_sys.h
index 21688533412..7ceb40e9e06 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -119,13 +119,14 @@ extern int NEAR my_errno; /* Last error in mysys */
/* defines when allocating data */
#ifdef SAFEMALLOC
-#define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG )
-#define my_malloc_ci(SZ,FLAG) _mymalloc( SZ, sFile, uLine, FLAG )
-#define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG )
+#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
+#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG )
+#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG )
#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
-#define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG)
-#define my_memdup(A,B,C) _my_memdup(A,B,__FILE__,__LINE__,C)
-#define my_strdup(A,C) _my_strdup(A,__FILE__,__LINE__,C)
+#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG)
+#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
+#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
+#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C)
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
@@ -145,7 +146,9 @@ extern gptr my_malloc(uint Size,myf MyFlags);
extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
extern void my_no_flags_free(gptr ptr);
extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
-extern my_string my_strdup(const char *from,myf MyFlags);
+extern char *my_strdup(const char *from,myf MyFlags);
+extern char *my_strdup_with_length(const byte *from, uint length,
+ myf MyFlags);
#define my_free(PTR,FG) my_no_flags_free(PTR)
#define CALLER_INFO_PROTO /* nothing */
#define CALLER_INFO /* nothing */
@@ -543,6 +546,10 @@ extern gptr _my_memdup(const byte *from,uint length,
const char *sFile, uint uLine,myf MyFlag);
extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
myf MyFlag);
+extern char *_my_strdup_with_length(const byte *from, uint length,
+ const char *sFile, uint uLine,
+ myf MyFlag);
+
#ifndef TERMINATE
extern void TERMINATE(FILE *file);
#endif
diff --git a/include/sslopt-usage.h b/include/sslopt-case.h
index e3536edf804..ea23c31aa82 100644
--- a/include/sslopt-usage.h
+++ b/include/sslopt-case.h
@@ -15,11 +15,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_OPENSSL
- puts("\
- --ssl Use SSL for connection (automatically set with other flags\n\
- --ssl-key X509 key in PEM format (implies --ssl)\n\
- --ssl-cert X509 cert in PEM format (implies --ssl)\n\
- --ssl-ca CA file in PEM format (check OpenSSL docs, implies --ssl)\n\
- --ssl-capath CA directory (check OpenSSL docs, implies --ssl)\n\
- --ssl-cipher SSL cipher to use (implies --ssl)");
+ case OPT_SSL_KEY:
+ case OPT_SSL_CERT:
+ case OPT_SSL_CA:
+ case OPT_SSL_CAPATH:
+ case OPT_SSL_CIPHER:
+ /*
+ Enable use of SSL if we are using any ssl option
+ One can disable SSL later by using --skip-ssl or --ssl=0
+ */
+ opt_use_ssl= 1;
+ break;
#endif
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index 811fbcbbdd6..397d8baa9d6 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -17,8 +17,8 @@
#ifdef HAVE_OPENSSL
{"ssl", OPT_SSL_SSL,
- "Use SSL for connection (automatically set with other flags)",
- (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl",
+ (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl)",
(gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
diff --git a/include/violite.h b/include/violite.h
index 6dd7b765071..f4f40dcb64b 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -175,7 +175,7 @@ struct st_VioSSLConnectorFd
};
void sslaccept(struct st_VioSSLAcceptorFd*, Vio*, long timeout);
-void sslconnect(struct st_VioSSLConnectorFd*, Vio*, long timeout);
+int sslconnect(struct st_VioSSLConnectorFd*, Vio*, long timeout);
struct st_VioSSLConnectorFd
*new_VioSSLConnectorFd(const char* key_file, const char* cert_file,
@@ -193,7 +193,14 @@ Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state);
#endif /* HAVE_OPENSSL */
/* This enumerator is used in parser - should be always visible */
-enum SSL_type {SSL_TYPE_NONE, SSL_TYPE_ANY, SSL_TYPE_X509, SSL_TYPE_SPECIFIED};
+enum SSL_type
+{
+ SSL_TYPE_NOT_SPECIFIED= -1,
+ SSL_TYPE_NONE,
+ SSL_TYPE_ANY,
+ SSL_TYPE_X509,
+ SSL_TYPE_SPECIFIED
+};
#ifndef EMBEDDED_LIBRARY
/* This structure is for every connection on both sides */
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index 38d97785832..7a7678b2dcf 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -22,6 +22,25 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
/*
+Latching strategy of the InnoDB B-tree
+--------------------------------------
+A tree latch protects all non-leaf nodes of the tree. Each node of a tree
+also has a latch of its own.
+
+A B-tree operation normally first acquires an S-latch on the tree. It
+searches down the tree and releases the tree latch when it has the
+leaf node latch. To save CPU time we do not acquire any latch on
+non-leaf nodes of the tree during a search, those pages are only bufferfixed.
+
+If an operation needs to restructure the tree, it acquires an X-latch on
+the tree before searching to a leaf node. If it needs, for example, to
+split a leaf,
+(1) InnoDB decides the split point in the leaf,
+(2) allocates a new page,
+(3) inserts the appropriate node pointer to the first non-leaf level,
+(4) releases the tree X-latch,
+(5) and then moves records from the leaf to the new allocated page.
+
Node pointers
-------------
Leaf pages of a B-tree contain the index records stored in the
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index bab5c78b712..e35ff2ca69e 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -302,6 +302,9 @@ btr_cur_search_to_nth_level(
rw_lock_s_unlock(&btr_search_latch);
}
+ /* Store the position of the tree latch we push to mtr so that we
+ know how to release it when we have latched leaf node(s) */
+
savepoint = mtr_set_savepoint(mtr);
tree = index->tree;
@@ -506,12 +509,18 @@ btr_cur_open_at_index_side(
ulint root_height = 0; /* remove warning */
rec_t* node_ptr;
ulint estimate;
+ ulint savepoint;
estimate = latch_mode & BTR_ESTIMATE;
latch_mode = latch_mode & ~BTR_ESTIMATE;
tree = index->tree;
+ /* Store the position of the tree latch we push to mtr so that we
+ know how to release it when we have latched the leaf node */
+
+ savepoint = mtr_set_savepoint(mtr);
+
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
} else {
@@ -544,6 +553,22 @@ btr_cur_open_at_index_side(
if (height == 0) {
btr_cur_latch_leaves(tree, page, space, page_no,
latch_mode, cursor, mtr);
+
+ /* In versions <= 3.23.52 we had forgotten to
+ release the tree latch here. If in an index scan
+ we had to scan far to find a record visible to the
+ current transaction, that could starve others
+ waiting for the tree latch. */
+
+ if ((latch_mode != BTR_MODIFY_TREE)
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+
+ /* Release the tree s-latch */
+
+ mtr_release_s_latch_at_savepoint(
+ mtr, savepoint,
+ dict_tree_get_lock(tree));
+ }
}
if (from_left) {
@@ -808,7 +833,7 @@ btr_cur_optimistic_insert(
if (!dtuple_check_typed_no_assert(entry)) {
fprintf(stderr,
-"InnoDB: Error in a tuple to insert into table %lu index %s\n",
+"InnoDB: Error in a tuple to insert into table %s index %s\n",
index->table_name, index->name);
}
diff --git a/innobase/configure.in b/innobase/configure.in
index 237db834f7a..761859e5da3 100644
--- a/innobase/configure.in
+++ b/innobase/configure.in
@@ -90,6 +90,8 @@ case "$target_os" in
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
hp*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
+ aix*)
+ CFLAGS="$CFLAGS -DUNIV_AIX";;
irix*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
osf*)
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 85199b90a5a..095c27f1c5f 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -308,13 +308,28 @@ dict_table_autoinc_get(
}
/************************************************************************
-Reads the autoinc counter value, 0 if not yet initialized. Does not
-increment the counter. */
+Decrements the autoinc counter value by 1. */
+
+void
+dict_table_autoinc_decrement(
+/*=========================*/
+ dict_table_t* table) /* in: table */
+{
+ mutex_enter(&(table->autoinc_mutex));
+
+ table->autoinc = table->autoinc - 1;
+
+ mutex_exit(&(table->autoinc_mutex));
+}
+
+/************************************************************************
+Reads the next autoinc value (== autoinc counter value), 0 if not yet
+initialized. */
ib_longlong
dict_table_autoinc_read(
/*====================*/
- /* out: value of the counter */
+ /* out: value for a new row, or 0 */
dict_table_t* table) /* in: table */
{
ib_longlong value;
@@ -3094,7 +3109,7 @@ static
void
dict_print_info_on_foreign_keys_in_create_format(
/*=============================================*/
- char* buf, /* in: auxiliary buffer of 10000 chars */
+ char* buf, /* in: auxiliary buffer */
char* str, /* in/out: pointer to a string */
ulint len, /* in: space in str available for info */
dict_table_t* table) /* in: table */
@@ -3120,6 +3135,9 @@ dict_print_info_on_foreign_keys_in_create_format(
buf2 += sprintf(buf2, ",\n FOREIGN KEY (");
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
buf2 += sprintf(buf2, "`%s`",
foreign->foreign_col_names[i]);
@@ -3142,6 +3160,9 @@ dict_print_info_on_foreign_keys_in_create_format(
}
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
buf2 += sprintf(buf2, "`%s`",
foreign->referenced_col_names[i]);
if (i + 1 < foreign->n_fields) {
@@ -3161,7 +3182,7 @@ dict_print_info_on_foreign_keys_in_create_format(
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
}
-
+no_space:
mutex_exit(&(dict_sys->mutex));
buf[len - 1] = '\0';
@@ -3185,16 +3206,17 @@ dict_print_info_on_foreign_keys(
dict_foreign_t* foreign;
ulint i;
char* buf2;
- char buf[10000];
+ char* buf;
+
+ buf = mem_alloc(len + 5000);
if (create_table_format) {
dict_print_info_on_foreign_keys_in_create_format(
buf, str, len, table);
+ mem_free(buf);
return;
}
- buf2 = buf;
-
mutex_enter(&(dict_sys->mutex));
foreign = UT_LIST_GET_FIRST(table->foreign_list);
@@ -3202,13 +3224,21 @@ dict_print_info_on_foreign_keys(
if (foreign == NULL) {
mutex_exit(&(dict_sys->mutex));
+ mem_free(buf);
return;
}
+ buf2 = buf;
+
while (foreign != NULL) {
+
buf2 += sprintf(buf2, "; (");
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
+
buf2 += sprintf(buf2, "%s",
foreign->foreign_col_names[i]);
@@ -3221,6 +3251,9 @@ dict_print_info_on_foreign_keys(
foreign->referenced_table_name);
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
buf2 += sprintf(buf2, "%s",
foreign->referenced_col_names[i]);
if (i + 1 < foreign->n_fields) {
@@ -3240,9 +3273,11 @@ dict_print_info_on_foreign_keys(
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
}
-
+no_space:
mutex_exit(&(dict_sys->mutex));
buf[len - 1] = '\0';
ut_memcpy(str, buf, len);
+
+ mem_free(buf);
}
diff --git a/innobase/dict/dict0mem.c b/innobase/dict/dict0mem.c
index 9a4c94de885..e5918c6aeb6 100644
--- a/innobase/dict/dict0mem.c
+++ b/innobase/dict/dict0mem.c
@@ -74,6 +74,8 @@ dict_mem_table_create(
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
+ table->query_cache_inv_trx_id = ut_dulint_zero;
+
UT_LIST_INIT(table->locks);
UT_LIST_INIT(table->foreign_list);
UT_LIST_INIT(table->referenced_list);
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index 832654d2666..dd92c5aa467 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -114,13 +114,20 @@ dict_table_autoinc_get(
/* out: value for a new row, or 0 */
dict_table_t* table); /* in: table */
/************************************************************************
-Reads the autoinc counter value, 0 if not yet initialized. Does not
-increment the counter. */
+Decrements the autoinc counter value by 1. */
+
+void
+dict_table_autoinc_decrement(
+/*=========================*/
+ dict_table_t* table); /* in: table */
+/************************************************************************
+Reads the next autoinc value (== autoinc counter value), 0 if not yet
+initialized. */
ib_longlong
dict_table_autoinc_read(
/*====================*/
- /* out: value of the counter */
+ /* out: value for a new row, or 0 */
dict_table_t* table); /* in: table */
/************************************************************************
Peeks the autoinc counter value, 0 if not yet initialized. Does not
diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h
index cc27f2bad12..22293389bae 100644
--- a/innobase/include/dict0mem.h
+++ b/innobase/include/dict0mem.h
@@ -333,6 +333,13 @@ struct dict_table_struct{
space from the lock heap of the trx:
otherwise the lock heap would grow rapidly
if we do a large insert from a select */
+ dulint query_cache_inv_trx_id;
+ /* transactions whose trx id < than this
+ number are not allowed to store to the MySQL
+ query cache or retrieve from it; when a trx
+ with undo logs commits, it sets this to the
+ value of the trx id counter for the tables it
+ had an IX lock on */
UT_LIST_BASE_NODE_T(lock_t)
locks; /* list of locks on the table */
/*----------------------*/
diff --git a/innobase/include/row0sel.h b/innobase/include/row0sel.h
index a64d3f8e425..aa2da6fe5f6 100644
--- a/innobase/include/row0sel.h
+++ b/innobase/include/row0sel.h
@@ -133,6 +133,18 @@ row_search_for_mysql(
then prebuilt must have a pcur
with stored position! In opening of a
cursor 'direction' should be 0. */
+/***********************************************************************
+Checks if MySQL at the moment is allowed for this table to retrieve a
+consistent read result, or store it to the query cache. */
+
+ibool
+row_search_check_if_query_cache_permitted(
+/*======================================*/
+ /* out: TRUE if storing or retrieving from
+ the query cache is permitted */
+ trx_t* trx, /* in: transaction object */
+ char* norm_name); /* in: concatenation of database name, '/'
+ char, table name */
/* A structure for caching column values for prefetched rows */
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index 178c7b6971f..9de5e9ccfc9 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -53,7 +53,7 @@ extern ulint srv_n_log_files;
extern ulint srv_log_file_size;
extern ibool srv_log_archive_on;
extern ulint srv_log_buffer_size;
-extern ibool srv_flush_log_at_trx_commit;
+extern ulint srv_flush_log_at_trx_commit;
extern byte srv_latin1_ordering[256];/* The sort order table of the latin1
character set */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index e1f65e9da0f..9b29c481b6d 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -118,6 +118,14 @@ trx_start_if_not_started(
/*=====================*/
trx_t* trx); /* in: transaction */
/*****************************************************************
+Starts the transaction if it is not yet started. Assumes we have reserved
+the kernel mutex! */
+UNIV_INLINE
+void
+trx_start_if_not_started_low(
+/*=========================*/
+ trx_t* trx); /* in: transaction */
+/*****************************************************************
Starts the transaction if it is not yet started. */
void
diff --git a/innobase/include/trx0trx.ic b/innobase/include/trx0trx.ic
index 9d453047600..78e5acda148 100644
--- a/innobase/include/trx0trx.ic
+++ b/innobase/include/trx0trx.ic
@@ -21,3 +21,22 @@ trx_start_if_not_started(
trx_start(trx, ULINT_UNDEFINED);
}
}
+
+/*****************************************************************
+Starts the transaction if it is not yet started. Assumes we have reserved
+the kernel mutex! */
+UNIV_INLINE
+void
+trx_start_if_not_started_low(
+/*=========================*/
+ trx_t* trx) /* in: transaction */
+{
+ ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
+
+ if (trx->conc_state == TRX_NOT_STARTED) {
+
+ trx_start_low(trx, ULINT_UNDEFINED);
+ }
+}
+
+
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 8c48180cf63..ebd063b6ca5 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -14,6 +14,8 @@ Created 5/7/1996 Heikki Tuuri
#include "usr0sess.h"
#include "trx0purge.h"
+#include "dict0mem.h"
+#include "trx0sys.h"
/* Restricts the length of search we will do in the waits-for
graph of transactions */
@@ -3416,8 +3418,9 @@ lock_release_off_kernel(
/*====================*/
trx_t* trx) /* in: transaction */
{
- ulint count;
- lock_t* lock;
+ dict_table_t* table;
+ ulint count;
+ lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
@@ -3435,6 +3438,19 @@ lock_release_off_kernel(
} else {
ut_ad(lock_get_type(lock) == LOCK_TABLE);
+ if (lock_get_mode(lock) != LOCK_IS
+ && (trx->insert_undo || trx->update_undo)) {
+
+ /* The trx may have modified the table.
+ We block the use of the MySQL query cache
+ for all currently active transactions. */
+
+ table = lock->un_member.tab_lock.table;
+
+ table->query_cache_inv_trx_id =
+ trx_sys->max_trx_id;
+ }
+
lock_table_dequeue(lock);
}
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 3ca0fbd68a4..b2881581fc7 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -11,11 +11,10 @@ Created 10/21/1995 Heikki Tuuri
#include "ut0mem.h"
#include "srv0srv.h"
#include "fil0fil.h"
+#include "buf0buf.h"
#undef HAVE_FDATASYNC
-#undef UNIV_NON_BUFFERED_IO
-
#ifdef POSIX_ASYNC_IO
/* We assume in this case that the OS has standard Posix aio (at least SunOS
2.6, HP-UX 11i and AIX 4.3 have) */
@@ -499,14 +498,25 @@ try_again:
}
#endif
#ifdef UNIV_NON_BUFFERED_IO
- attributes = attributes | FILE_FLAG_NO_BUFFERING;
+ if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
+ /* Do not use unbuffered i/o to log files because
+ value 2 denotes that we do not flush the log at every
+ commit, but only once per second */
+ } else {
+ attributes = attributes | FILE_FLAG_NO_BUFFERING;
+ }
#endif
} else if (purpose == OS_FILE_NORMAL) {
- attributes = 0
+ attributes = 0;
#ifdef UNIV_NON_BUFFERED_IO
- | FILE_FLAG_NO_BUFFERING
+ if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
+ /* Do not use unbuffered i/o to log files because
+ value 2 denotes that we do not flush the log at every
+ commit, but only once per second */
+ } else {
+ attributes = attributes | FILE_FLAG_NO_BUFFERING;
+ }
#endif
- ;
} else {
attributes = 0;
ut_error;
@@ -659,13 +669,14 @@ os_file_get_size(
return(FALSE);
}
-#if SIZEOF_OFF_T > 4
- *size = (ulint)(offs & 0xFFFFFFFF);
- *size_high = (ulint)(offs >> 32);
-#else
- *size = (ulint) offs;
- *size_high = 0;
-#endif
+ if (sizeof(off_t) > 4) {
+ *size = (ulint)(offs & 0xFFFFFFFF);
+ *size_high = (ulint)(offs >> 32);
+ } else {
+ *size = (ulint) offs;
+ *size_high = 0;
+ }
+
return(TRUE);
#endif
}
@@ -828,16 +839,18 @@ os_file_pread(
/* If off_t is > 4 bytes in size, then we assume we can pass a
64-bit address */
-#if SIZEOF_OFF_T > 4
- offs = (off_t)offset + (((off_t)offset_high) << 32);
-#else
- offs = (off_t)offset;
+ if (sizeof(off_t) > 4) {
+ offs = (off_t)offset + (((off_t)offset_high) << 32);
+
+ } else {
+ offs = (off_t)offset;
- if (offset_high > 0) {
- fprintf(stderr,
- "InnoDB: Error: file read at offset > 4 GB\n");
+ if (offset_high > 0) {
+ fprintf(stderr,
+ "InnoDB: Error: file read at offset > 4 GB\n");
+ }
}
-#endif
+
os_n_file_reads++;
#ifdef HAVE_PREAD
@@ -2105,6 +2118,7 @@ os_aio_simulated_handle(
ibool ret;
ulint n;
ulint i;
+ ulint len2;
segment = os_aio_get_array_and_local_segment(&array, global_segment);
@@ -2260,6 +2274,29 @@ consecutive_loop:
/* Do the i/o with ordinary, synchronous i/o functions: */
if (slot->type == OS_FILE_WRITE) {
+ if (array == os_aio_write_array) {
+
+ /* Do a 'last millisecond' check that the page end
+ is sensible; reported page checksum errors from
+ Linux seem to wipe over the page end */
+
+ for (len2 = 0; len2 + UNIV_PAGE_SIZE <= total_len;
+ len2 += UNIV_PAGE_SIZE) {
+ if (mach_read_from_4(combined_buf + len2
+ + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(combined_buf + len2
+ + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: ERROR: The page to be written seems corrupt!\n");
+ buf_page_print(combined_buf + len2);
+ fprintf(stderr,
+"InnoDB: ERROR: The page to be written seems corrupt!\n");
+ }
+ }
+ }
+
ret = os_file_write(slot->name, slot->file, combined_buf,
slot->offset, slot->offset_high, total_len);
} else {
diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c
index c1345de0d55..14677ede20f 100644
--- a/innobase/os/os0sync.c
+++ b/innobase/os/os0sync.c
@@ -49,6 +49,12 @@ os_event_create(
TRUE, /* Manual reset */
FALSE, /* Initial state nonsignaled */
name);
+ if (!event) {
+ fprintf(stderr,
+"InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
+ (ulint)GetLastError());
+ }
+
ut_a(event);
return(event);
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index 13990b6743b..146303b2791 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -128,8 +128,28 @@ os_thread_create(
pthread_attr_init(&attr);
+#ifdef UNIV_AIX
+ /* We must make sure a thread stack is at least 32 kB, otherwise
+ InnoDB might crash; we do not know if the default stack size on
+ AIX is always big enough. An empirical test on AIX-4.3 suggested
+ the size was 96 kB, though. */
+
+ ret = pthread_attr_setstacksize(&attr,
+ (size_t)(PTHREAD_STACK_MIN + 32 * 1024));
+ if (ret) {
+ fprintf(stderr,
+ "InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
+ exit(1);
+ }
+#endif
ret = pthread_create(&pthread, &attr, start_f, arg);
+ if (ret) {
+ fprintf(stderr,
+ "InnoDB: Error: pthread_create returned %d\n", ret);
+ exit(1);
+ }
+
pthread_attr_destroy(&attr);
if (srv_set_thread_priorities) {
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index 2e6dde6db65..941c9d5759d 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -32,6 +32,25 @@ Created 4/20/1996 Heikki Tuuri
#define ROW_INS_PREV 1
#define ROW_INS_NEXT 2
+
+/*********************************************************************
+This prototype is copied from /mysql/sql/ha_innodb.cc.
+Invalidates the MySQL query cache for the table.
+NOTE that the exact prototype of this function has to be in
+/innobase/row/row0ins.c! */
+
+void
+innobase_invalidate_query_cache(
+/*============================*/
+ trx_t* trx, /* in: transaction which modifies the table */
+ char* full_name, /* in: concatenation of database name, null
+ char '\0', table name, null char'\0';
+ NOTE that in Windows this is always
+ in LOWER CASE! */
+ ulint full_name_len); /* in: full name length where also the null
+ chars count */
+
+
/*************************************************************************
Creates an insert node struct. */
@@ -386,10 +405,30 @@ row_ins_foreign_delete_or_set_null(
upd_t* update;
ulint err;
ulint i;
+ char* ptr;
+ char table_name_buf[1000];
char err_buf[1000];
ut_a(thr && foreign && pcur && mtr);
+ /* Since we are going to delete or update a row, we have to invalidate
+ the MySQL query cache for table */
+
+ ut_a(ut_strlen(table->name) < 998);
+
+ ut_memcpy(table_name_buf, table->name, ut_strlen(table->name) + 1);
+
+ ptr = table_name_buf;
+
+ while (*ptr != '/') {
+ ptr++;
+ }
+
+ *ptr = '\0';
+
+ /* We call a function in ha_innodb.cc */
+ innobase_invalidate_query_cache(thr_get_trx(thr), table_name_buf,
+ ut_strlen(table->name) + 1);
node = thr->run_node;
ut_a(que_node_get_type(node) == QUE_NODE_UPDATE);
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 3ee458f43bf..cea8f1316fe 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -1186,7 +1186,7 @@ row_create_table_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(mutex_own(&(dict_sys->mutex)));
- if (srv_created_new_raw || srv_force_recovery) {
+ if (srv_created_new_raw) {
fprintf(stderr,
"InnoDB: A new raw disk partition was initialized or\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
@@ -1350,7 +1350,9 @@ row_create_table_for_mysql(
"InnoDB: creating an InnoDB table with the same name in another\n"
"InnoDB: database and moving the .frm file to the current database.\n"
"InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
- "InnoDB: succeed.\n");
+ "InnoDB: succeed.\n"
+ "InnoDB: You can look further help from section 15.1 of\n"
+ "InnoDB: http://www.innodb.com/ibman.html\n");
}
trx->error_state = DB_SUCCESS;
@@ -1705,7 +1707,7 @@ row_drop_table_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_a(name != NULL);
- if (srv_created_new_raw || srv_force_recovery) {
+ if (srv_created_new_raw) {
fprintf(stderr,
"InnoDB: A new raw disk partition was initialized or\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
@@ -1872,7 +1874,9 @@ row_drop_table_for_mysql(
" InnoDB: Error: table %s does not exist in the InnoDB internal\n"
"InnoDB: data dictionary though MySQL is trying to drop it.\n"
"InnoDB: Have you copied the .frm file of the table to the\n"
- "InnoDB: MySQL database directory from another database?\n",
+ "InnoDB: MySQL database directory from another database?\n"
+ "InnoDB: You can look further help from section 15.1 of\n"
+ "InnoDB: http://www.innodb.com/ibman.html\n",
name);
goto funct_exit;
}
@@ -2194,7 +2198,9 @@ row_rename_table_for_mysql(
fprintf(stderr,
" InnoDB: Error: table %s exists in the InnoDB internal data\n"
"InnoDB: dictionary though MySQL is trying rename table %s to it.\n"
- "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n",
+ "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n"
+ "InnoDB: You can look further help from section 15.1 of\n"
+ "InnoDB: http://www.innodb.com/ibman.html\n",
new_name, old_name);
fprintf(stderr,
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index f3dced15fdf..4af04251996 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -30,6 +30,7 @@ Created 12/19/1997 Heikki Tuuri
#include "pars0sym.h"
#include "pars0pars.h"
#include "row0mysql.h"
+#include "read0read.h"
/* Maximum number of rows to prefetch; MySQL interface has another parameter */
#define SEL_MAX_N_PREFETCH 16
@@ -3115,3 +3116,56 @@ normal_return:
return(ret);
}
+
+/***********************************************************************
+Checks if MySQL at the moment is allowed for this table to retrieve a
+consistent read result, or store it to the query cache. */
+
+ibool
+row_search_check_if_query_cache_permitted(
+/*======================================*/
+ /* out: TRUE if storing or retrieving from
+ the query cache is permitted */
+ trx_t* trx, /* in: transaction object */
+ char* norm_name) /* in: concatenation of database name, '/'
+ char, table name */
+{
+ dict_table_t* table;
+ ibool ret = FALSE;
+
+ table = dict_table_get(norm_name, trx);
+
+ if (table == NULL) {
+
+ return(FALSE);
+ }
+
+ mutex_enter(&kernel_mutex);
+
+ /* Start the transaction if it is not started yet */
+
+ trx_start_if_not_started_low(trx);
+
+ /* If there are locks on the table or some trx has invalidated the
+ cache up to our trx id, then ret = FALSE.
+ We do not check what type locks there are on the table, though only
+ IX type locks actually would require ret = FALSE. */
+
+ if (UT_LIST_GET_LEN(table->locks) == 0
+ && ut_dulint_cmp(trx->id, table->query_cache_inv_trx_id) >= 0) {
+
+ ret = TRUE;
+
+ /* Assign a read view for the transaction if it does not yet
+ have one */
+
+ if (!trx->read_view) {
+ trx->read_view = read_view_open_now(trx,
+ trx->read_view_heap);
+ }
+ }
+
+ mutex_exit(&kernel_mutex);
+
+ return(ret);
+}
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index d0ac011e60f..d754f603efc 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -96,7 +96,7 @@ ulint srv_n_log_files = ULINT_MAX;
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
ibool srv_log_archive_on = TRUE;
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
-ibool srv_flush_log_at_trx_commit = TRUE;
+ulint srv_flush_log_at_trx_commit = 1;
byte srv_latin1_ordering[256] /* The sort order table of the latin1
character set. The following table is
@@ -2825,7 +2825,11 @@ background_loop:
srv_main_thread_op_info = (char*)"purging";
- n_pages_purged = trx_purge();
+ if (srv_fast_shutdown && srv_shutdown_state > 0) {
+ n_pages_purged = 0;
+ } else {
+ n_pages_purged = trx_purge();
+ }
srv_main_thread_op_info = (char*)"reserving kernel mutex";
@@ -2837,7 +2841,12 @@ background_loop:
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = (char*)"doing insert buffer merge";
- n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
+
+ if (srv_fast_shutdown && srv_shutdown_state > 0) {
+ n_bytes_merged = 0;
+ } else {
+ n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
+ }
srv_main_thread_op_info = (char*)"reserving kernel mutex";
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 4d14c32b1ae..4854b40409e 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -924,7 +924,7 @@ sync_array_print_long_waits(void)
}
if (cell->wait_object != NULL
- && difftime(time(NULL), cell->reservation_time) > 420) {
+ && difftime(time(NULL), cell->reservation_time) > 600) {
fprintf(stderr,
"InnoDB: Error: semaphore wait has lasted > 600 seconds\n"
diff --git a/innobase/trx/trx0undo.c b/innobase/trx/trx0undo.c
index 6303c5bbcdd..34f56dba130 100644
--- a/innobase/trx/trx0undo.c
+++ b/innobase/trx/trx0undo.c
@@ -401,6 +401,10 @@ trx_undo_seg_create(
slot_no = trx_rsegf_undo_find_free(rseg_hdr, mtr);
if (slot_no == ULINT_UNDEFINED) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+"InnoDB: Warning: cannot find a free slot for an undo log. Do you have too\n"
+"InnoDB: many active transactions running concurrently?");
return(NULL);
}
@@ -1532,9 +1536,6 @@ trx_undo_assign_undo(
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
- fprintf(stderr, "InnoDB: no undo log slots free\n");
- ut_a(0);
-
return(NULL);
}
}
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 16fecc8038f..1b5d59807cd 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1121,21 +1121,21 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length)
{
+ DBUG_ENTER("mysql_master_query");
if (mysql_master_send_query(mysql, q, length))
- return 1;
- return mysql_read_query_result(mysql);
+ DBUG_RETURN(1);
+ DBUG_RETURN(mysql_read_query_result(mysql));
}
my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length)
{
- MYSQL*master = mysql->master;
- if (!length)
- length = strlen(q);
+ MYSQL *master = mysql->master;
+ DBUG_ENTER("mysql_master_send_query");
if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0))
- return 1;
+ DBUG_RETURN(1);
mysql->last_used_con = master;
- return simple_command(master, COM_QUERY, q, length, 1);
+ DBUG_RETURN(simple_command(master, COM_QUERY, q, length, 1));
}
@@ -1143,9 +1143,10 @@ my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length)
{
+ DBUG_ENTER("mysql_slave_query");
if (mysql_slave_send_query(mysql, q, length))
- return 1;
- return mysql_read_query_result(mysql);
+ DBUG_RETURN(1);
+ DBUG_RETURN(mysql_read_query_result(mysql));
}
@@ -1153,21 +1154,21 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length)
{
MYSQL* last_used_slave, *slave_to_use = 0;
+ DBUG_ENTER("mysql_slave_send_query");
if ((last_used_slave = mysql->last_used_slave))
slave_to_use = last_used_slave->next_slave;
else
slave_to_use = mysql->next_slave;
- /* next_slave is always safe to use - we have a circular list of slaves
- if there are no slaves, mysql->next_slave == mysql
+ /*
+ Next_slave is always safe to use - we have a circular list of slaves
+ if there are no slaves, mysql->next_slave == mysql
*/
mysql->last_used_con = mysql->last_used_slave = slave_to_use;
- if (!length)
- length = strlen(q);
if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0,
0,0,0,0))
- return 1;
- return simple_command(slave_to_use, COM_QUERY, q, length, 1);
+ DBUG_RETURN(1);
+ DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, q, length, 1));
}
@@ -1380,8 +1381,7 @@ err:
enum mysql_rpl_type
STDCALL mysql_rpl_query_type(const char* q, int len)
{
- const char* q_end;
- q_end = (len) ? q + len : strend(q);
+ const char *q_end= q + len;
for (; q < q_end; ++q)
{
char c;
@@ -1426,13 +1426,12 @@ mysql_init(MYSQL *mysql)
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
return 0;
mysql->free_me=1;
- mysql->net.vio = 0;
}
else
bzero((char*) (mysql),sizeof(*(mysql)));
mysql->options.connect_timeout=CONNECT_TIMEOUT;
mysql->last_used_con = mysql->next_slave = mysql->master = mysql;
- mysql->last_used_slave = 0;
+
/*
By default, we are a replication pivot. The caller must reset it
after we return if this is not the case.
@@ -2278,20 +2277,24 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{
+ DBUG_ENTER("mysql_send_query");
+ DBUG_PRINT("enter",("rpl_parse: %d rpl_pivot: %d",
+ mysql->options.rpl_parse, mysql->rpl_pivot));
+
if (mysql->options.rpl_parse && mysql->rpl_pivot)
{
switch (mysql_rpl_query_type(query, length)) {
case MYSQL_RPL_MASTER:
- return mysql_master_send_query(mysql, query, length);
+ DBUG_RETURN(mysql_master_send_query(mysql, query, length));
case MYSQL_RPL_SLAVE:
- return mysql_slave_send_query(mysql, query, length);
+ DBUG_RETURN(mysql_slave_send_query(mysql, query, length));
case MYSQL_RPL_ADMIN:
break; /* fall through */
}
}
mysql->last_used_con = mysql;
- return simple_command(mysql, COM_QUERY, query, length, 1);
+ DBUG_RETURN(simple_command(mysql, COM_QUERY, query, length, 1));
}
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index f72f045c96c..c15d6be61f4 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -1,14 +1,11 @@
LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 4.0 Client Library'
-VERSION 4.0
+VERSION 5.0
EXPORTS
mysql_affected_rows
mysql_close
- mysql_connect
- mysql_create_db
mysql_data_seek
mysql_debug
- mysql_drop_db
mysql_dump_debug_info
mysql_eof
mysql_errno
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index 98d38531f64..2b52b133133 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -8,8 +8,8 @@ link_sources:
done;
DEFS = -DEMBEDDED_LIBRARY
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes) \
- -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/client
+INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
+ -I$(top_srcdir) -I$(top_srcdir)/client $(openssl_includes)
LIBS = @LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS)
diff --git a/libmysqld/lib_load.cc b/libmysqld/lib_load.cc
deleted file mode 100644
index 3db5a2488d1..00000000000
--- a/libmysqld/lib_load.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000
- * SWsoft company
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-/* Copy data from a textfile to table */
-
-#include "mysql_priv.h"
-#include <my_dir.h>
-#include <m_ctype.h>
-
-
-int
-mysql_load_internal(THD * thd, sql_exchange * ex, TABLE_LIST * table_list,
- List<Item> & fields, enum enum_duplicates handle_duplicates,
- bool read_file_from_client, thr_lock_type lock_type);
-
-int
-mysql_load(THD * thd, sql_exchange * ex, TABLE_LIST * table_list,
- List<Item> & fields, enum enum_duplicates handle_duplicates,
- bool read_file_from_client, thr_lock_type lock_type)
-{
- read_file_from_client = 0; //server is always in the same process
- return mysql_load_internal(thd, ex, table_list, fields, handle_duplicates,
- read_file_from_client, lock_type);
-}
-
-#define mysql_load mysql_load_internal
-
-
-#if defined (__WIN__)
-#include "../sql/sql_load.cpp"
-#else
-#include "../sql/sql_load.cc"
-#endif
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index a3e5bfb4fff..42ad0021542 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -513,6 +513,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
if (!opt_noacl)
(void) grant_init();
init_max_user_conn();
+ init_update_queries();
#ifdef HAVE_DLOPEN
if (!opt_noacl)
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 9a2a29f9a08..fadffc0535e 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -93,6 +93,7 @@ typedef struct st_ft_info
CHARSET_INFO *charset;
enum { UNINITIALIZED, READY, INDEX_SEARCH, INDEX_DONE /*, SCAN*/ } state;
uint with_scan;
+ my_off_t lastpos;
FTB_EXPR *root;
QUEUE queue;
TREE no_dupes;
@@ -297,6 +298,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
default_charset_info :
info->s->keyinfo[keynr].seg->charset);
ftb->with_scan=0;
+ ftb->lastpos=0;
bzero(& ftb->no_dupes, sizeof(TREE));
init_alloc_root(&ftb->mem_root, 1024, 1024);
@@ -542,6 +544,21 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
if (!ftb->queue.elements)
return 0;
+ if (ftb->state != INDEX_SEARCH && docid < ftb->lastpos)
+ {
+ FTB_EXPR *x;
+ uint i;
+
+ for (i=0; i < ftb->queue.elements; i++)
+ {
+ ftb->list[i]->docid[1]=HA_POS_ERROR;
+ for (x=ftb->list[i]->up; x; x=x->up)
+ x->docid[1]=HA_POS_ERROR;
+ }
+ }
+
+ ftb->lastpos=docid;
+
if (ftb->keynr==NO_SUCH_KEY)
_mi_ft_segiterator_dummy_init(record, length, &ftsi);
else
@@ -559,7 +576,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
int a, b, c;
for (a=0, b=ftb->queue.elements, c=(a+b)/2; b-a>1; c=(a+b)/2)
{
- ftbw=(FTB_WORD *)(ftb->list[c]);
+ ftbw=ftb->list[c];
if (mi_compare_text(ftb->charset, word.pos, word.len,
(uchar*) ftbw->word+1, ftbw->len-1,
(my_bool) (ftbw->flags&FTB_FLAG_TRUNC)) >0)
@@ -569,7 +586,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
}
for (; c>=0; c--)
{
- ftbw=(FTB_WORD *)(ftb->list[c]);
+ ftbw=ftb->list[c];
if (mi_compare_text(ftb->charset, word.pos,word.len,
(uchar*) ftbw->word+1,ftbw->len-1,
(my_bool) (ftbw->flags&FTB_FLAG_TRUNC)))
@@ -616,3 +633,4 @@ void ft_boolean_reinit_search(FT_INFO *ftb)
{
_ftb_init_index_search(ftb);
}
+
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 10d7052fb0f..d4d6c45fbd6 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -1238,7 +1238,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
USE_WHOLE_KEY);
}
sort_info.dupp++;
- if (!(rep_quick & T_FORCE_UNIQUENESS))
+ if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
{
param->testflag|=T_RETRY_WITHOUT_QUICK;
param->error_printed=1;
@@ -2947,14 +2947,12 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
ulong block_length,reclength;
byte *from;
byte block_buff[8];
- MI_INFO *info;
SORT_INFO *sort_info=sort_param->sort_info;
- MYISAM_SHARE *share;
MI_CHECK *param=sort_info->param;
+ MI_INFO *info=sort_info->info;
+ MYISAM_SHARE *share=info->s;
DBUG_ENTER("sort_write_record");
- info=sort_info->info;
- share=info->s;
if (sort_param->fix_datafile)
{
switch (sort_info->new_data_file_type) {
@@ -3213,7 +3211,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param)
MI_INFO *info=sort_info->info;
DBUG_ENTER("sort_delete_record");
- if (!(param->testflag & T_FORCE_UNIQUENESS))
+ if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
{
mi_check_print_error(param,
"Quick-recover aborted; Run recovery without switch -q or with switch -qq");
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index ea26ed373d3..0fe983bf115 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -403,7 +403,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE);
- if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH)
+ if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
+ length > MI_MAX_KEY_LENGTH)
{
my_errno=HA_WRONG_CREATE_OPTION;
goto err;
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 519cc5bc2b8..39eb4b0bd99 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -34,7 +34,9 @@
HA_EXTRA_WRITE_CACHE
HA_EXTRA_CACHE
HA_EXTRA_BULK_INSERT_BEGIN
- If extra_arg is 0, then the default cache size is used.
+ If extra_arg is 0, then the default cache size is used.
+ HA_EXTRA_BULK_INSERT_FLUSH
+ extra_arg is a a pointer to which index to flush (uint*)
RETURN VALUES
0 ok
*/
@@ -356,6 +358,14 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
error=_mi_init_bulk_insert(info, (extra_arg ? *(ulong*) extra_arg :
myisam_bulk_insert_tree_size));
break;
+ case HA_EXTRA_BULK_INSERT_FLUSH:
+ if (info->bulk_insert)
+ {
+ uint index_to_flush= *(uint*) extra_arg;
+ if (is_tree_inited(&info->bulk_insert[index_to_flush]))
+ reset_tree(&info->bulk_insert[index_to_flush]);
+ }
+ break;
case HA_EXTRA_BULK_INSERT_END:
if (info->bulk_insert)
{
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 8cefd0d5ac1..3e8377fc8c0 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -72,7 +72,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name);
static int mi_sort_records(MI_CHECK *param, register MI_INFO *info,
my_string name, uint sort_key,
my_bool write_info, my_bool update_index);
-static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
+static int sort_record_index(MI_SORT_PARAM *sort_param, MI_INFO *info,
MI_KEYDEF *keyinfo,
my_off_t page,uchar *buff,uint sortkey,
File new_file, my_bool update_index);
@@ -186,7 +186,7 @@ static struct my_option my_long_options[] =
(gptr*) &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
- "Try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option if you are not totally desperate.",
+ "If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fast", 'F',
"Check only tables that haven't been closed properly.",
@@ -1470,6 +1470,7 @@ static int mi_sort_records(MI_CHECK *param,
sort_info.info=info;
sort_info.new_data_file_type=share->data_file_type;
sort_param.fix_datafile=1;
+ sort_param.master=1;
sort_param.filepos=share->pack.header_length;
old_record_count=info->state->records;
info->state->records=0;
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 104242cc3b1..8f90301d2d8 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 1997, 1998, 1999 TCX DataKonsult AB & Monty Program KB & Detron HB
+# Copyright (C) 1997-2002 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts creates the privilege tables db, host, user, tables_priv,
@@ -85,13 +85,15 @@ then
c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ 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 comment='Database privileges';"
- i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');
- INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');"
+ i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+ INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');"
fi
if test ! -f $mdata/host.frm
@@ -109,6 +111,8 @@ then
c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ 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 comment='Host privileges; Merged with database privileges';"
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 57b6ef056f2..3107737ca45 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -37,10 +37,11 @@ which ()
continue 2
fi
done
- echo "which: no $file in ($PATH)"
+ echo "Fatal error: Cannot find program $file in $PATH" 1>&2
exit 1
done
IFS="$save_ifs"
+ exit 0
}
@@ -68,7 +69,7 @@ sleep_until_file_created ()
do
if [ -r $file ]
then
- return
+ return 0
fi
sleep 1
loop=`expr $loop - 1`
@@ -81,8 +82,10 @@ sleep_until_file_created ()
SED=sed
-BASENAME=`which basename | $SED q`
+BASENAME=`which basename`
+if test $? != 0; then exit 1; fi
DIFF=`which diff | $SED q`
+if test $? != 0; then exit 1; fi
CAT=cat
CUT=cut
HEAD=head
@@ -90,12 +93,14 @@ TAIL=tail
ECHO=echo # use internal echo if possible
EXPR=expr # use internal if possible
FIND=find
-GCOV=`which gcov | $SED q`
+if test $? != 0; then exit 1; fi
PRINTF=printf
RM=rm
-TIME=`which time | $SED q`
+TIME=`which time`
+if test $? != 0; then exit 1; fi
TR=tr
-XARGS=`which xargs | $SED q`
+XARGS=`which xargs`
+if test $? != 0; then exit 1; fi
# Are we using a source or a binary distribution?
@@ -271,6 +276,7 @@ while test $# -gt 0; do
exit 1
fi
DO_GCOV=1
+ GCOV=`which gcov`
;;
--gprof )
DO_GPROF=1
@@ -462,7 +468,9 @@ GPROF_DIR=$MYSQL_TMP_DIR/gprof
GPROF_MASTER=$GPROF_DIR/master.gprof
GPROF_SLAVE=$GPROF_DIR/slave.gprof
TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
-XTERM=`which xterm`
+if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
+ XTERM=`which xterm`
+fi
#++
# Function Definitions
@@ -735,6 +743,8 @@ start_master()
$RM -f $MASTER_MYDDIR/log.*
# Remove stale binary logs
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
+ # Remove old master.info files
+ $RM -f $MYSQL_TEST_DIR/var/master-data/master.info
#run master initialization shell script if one exists
@@ -851,8 +861,9 @@ start_slave()
slave_pid=$SLAVE_MYPID
slave_sock="$SLAVE_MYSOCK"
fi
- # Remove stale binary logs
- $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-bin.*
+ # Remove stale binary logs and old master.info files
+ $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
+ $RM -f $MYSQL_TEST_DIR/$slave_datadir/master.info
#run slave initialization shell script if one exists
if [ -f "$slave_init_script" ] ;
@@ -1082,8 +1093,8 @@ run_testcase ()
start_master
fi
fi
- do_slave_restart=0
+ do_slave_restart=0
if [ -f $slave_opt_file ] ;
then
EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result
new file mode 100644
index 00000000000..095d89355ad
--- /dev/null
+++ b/mysql-test/r/bdb-alter-table-1.result
@@ -0,0 +1,11 @@
+drop table if exists t1;
+create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
+insert into t1 values(1, 't1',4,9);
+insert into t1 values(2, 'metatable',1,9);
+insert into t1 values(3, 'metaindex',1,9 );
+select * from t1;
+objid tablename oid test
+1 t1 4 9
+2 metatable 1 9
+3 metaindex 1 9
+alter table t1 drop column test;
diff --git a/mysql-test/r/bdb-alter-table-2.result b/mysql-test/r/bdb-alter-table-2.result
new file mode 100644
index 00000000000..c23b5ba0031
--- /dev/null
+++ b/mysql-test/r/bdb-alter-table-2.result
@@ -0,0 +1,6 @@
+select * from t1;
+objid tablename oid
+1 t1 4
+2 metatable 1
+3 metaindex 1
+drop table t1;
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index 9f1c8ffac41..325accf00e7 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t2;
create table t1 (name char(20) not null, primary key (name));
create table t2 (name char(20) binary not null, primary key (name));
insert into t1 values ("å");
@@ -53,3 +54,13 @@ select * from t1 where b="hello";
a b
hello hello
drop table t1;
+create table t1 (b char(8));
+insert into t1 values(NULL);
+select b from t1 where binary b like '';
+b
+select b from t1 group by binary b like '';
+b
+NULL
+select b from t1 having binary b like '';
+b
+drop table t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 4b2cbab8d6e..9b56b2b5160 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -154,3 +154,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
+create table t1 select if('2002'='2002','Y','N');
+select * from t1;
+if('2002'='2002','Y','N')
+Y
+drop table if exists t1;
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 44aef139ad2..9e375203e49 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 312e7893949..68fb8c39e6c 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -92,7 +92,8 @@ NULL NULL NULL
0 0
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
grp count(*)
-0 7
+NULL 1
+0 6
1 6
SELECT DISTINCT FACILITY FROM t1;
FACILITY
@@ -349,8 +350,7 @@ select distinct a from t1 where a >= '1' order by a desc;
a
1
drop table t1;
-CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
-DATETIME);
+CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
INSERT INTO t1 (email, infoID, dateentered) VALUES
('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
@@ -379,3 +379,19 @@ test2@testdomain.com Z001
test2@testdomain.com R002
test3@testdomain.com Z001
drop table t1,t2;
+CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
+INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
+CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
+INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
+SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
+privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate
+128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a int primary key, b int, c int);
+INSERT t1 VALUES (1,2,3);
+CREATE TABLE t2 (a int primary key, b int, c int);
+INSERT t2 VALUES (3,4,5);
+SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
+a b
+1 4
+DROP TABLE IF EXISTS t1,t2;
diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result
index 9f2ba6a5947..abc63358dbe 100644
--- a/mysql-test/r/fulltext_left_join.result
+++ b/mysql-test/r/fulltext_left_join.result
@@ -1,3 +1,4 @@
+drop table if exists t1, t2;
CREATE TABLE t1 (
id VARCHAR(255) NOT NULL PRIMARY KEY,
sujet VARCHAR(255),
diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result
index 8d88b8d6ebf..c0e72ff789f 100644
--- a/mysql-test/r/fulltext_order_by.result
+++ b/mysql-test/r/fulltext_order_by.result
@@ -64,3 +64,18 @@ a rel
4 1
7 1
drop table t1;
+CREATE TABLE t1 (
+a INT AUTO_INCREMENT PRIMARY KEY,
+message CHAR(20),
+FULLTEXT(message)
+);
+INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
+a rel
+1 1
+2 2
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
+a rel
+1 1
+2 2
+drop table t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 2d24b8ffd4e..c1f36283ab0 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t2;
create table t1 (grp int, a bigint unsigned, c char(10) not null);
insert into t1 values (1,1,"a");
insert into t1 values (2,2,"b");
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 8c991dee8d8..ba33ee0831d 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
CREATE TABLE t1 (field char(1));
INSERT INTO t1 VALUES ('A'),(NULL);
SELECT * from t1 WHERE field IN (NULL);
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index dd5e5191536..69e37d7b911 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -223,3 +223,8 @@ SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugs
CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter)
Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4
drop table t1;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM;
+INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
+SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
new file mode 100644
index 00000000000..a1a0c91a575
--- /dev/null
+++ b/mysql-test/r/grant.result
@@ -0,0 +1,60 @@
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+grant delete on mysqltest.* to mysqltest_1@localhost;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT, DELETE ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index d495dde75bf..35765c48049 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
-You have an error in your SQL syntax near '' at line 1
+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 '' at line 1
handler t2 close;
drop table if exists t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 704e7a45e59..34c2eef3fea 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -455,7 +455,7 @@ Duplicate entry 'test2' for key 2
select * from t1;
id ggid email passwd
1 this will work
-4 test2 this will work
+3 test2 this will work
select * from t1 where id=1;
id ggid email passwd
1 this will work
@@ -987,7 +987,7 @@ create table t1 (id int unsigned not null auto_increment, code tinyint unsigned
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT @@tx_isolation,@@global.tx_isolation;
-@@tx_isolation @@tx_isolation
+@@tx_isolation @@global.tx_isolation
SERIALIZABLE READ-COMMITTED
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
select id, code, name from t1 order by id;
diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result
index 73368c932af..a55114a0e3d 100644
--- a/mysql-test/r/innodb_handler.result
+++ b/mysql-test/r/innodb_handler.result
@@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
-You have an error in your SQL syntax near '' at line 1
+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 '' at line 1
handler t2 close;
drop table if exists t1;
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index b27cbb46210..2ffa9d88618 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -41,6 +41,14 @@ a t>0 c i
5 0 a NULL
6 1 hello NULL
drop table t1;
+create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id));
+insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
+select * from t1;
+sid id
+skr 1
+skr 2
+test 1
+drop table t1;
drop database if exists foo;
create database foo;
use foo;
diff --git a/mysql-test/r/key_primary.result b/mysql-test/r/key_primary.result
index 10771a134fc..87289f1cf54 100644
--- a/mysql-test/r/key_primary.result
+++ b/mysql-test/r/key_primary.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (t1 char(3) primary key);
insert into t1 values("ABC");
insert into t1 values("ABA");
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index 6fe8cc71185..20bc9b9572f 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
new file mode 100644
index 00000000000..1caaf317c96
--- /dev/null
+++ b/mysql-test/r/lowercase_table.result
@@ -0,0 +1,15 @@
+drop table if exists t1,t2,t3;
+create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
+INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
+SELECT * FROM t1;
+id Word
+1 a
+2 b
+3 c
+RENAME TABLE T1 TO T2;
+ALTER TABLE T2 ADD new_col int not null;
+ALTER TABLE T2 RENAME T3;
+show tables like 't_';
+Tables_in_test (t_)
+t3
+drop table t3;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index d1de03712ba..f66d211a987 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -100,3 +100,17 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES (1), (2), (3);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
+Specified key was too long. Max key length is 500
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
+ALTER TABLE t1 ADD INDEX t1 (a, b, c);
+Specified key was too long. Max key length is 500
+DROP TABLE t1;
diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result
index c696cf94e9d..5aa163a663e 100644
--- a/mysql-test/r/odbc.result
+++ b/mysql-test/r/odbc.result
@@ -1,6 +1,7 @@
select {fn length("hello")}, { date "1997-10-20" };
{fn length("hello")} 1997-10-20
5 1997-10-20
+drop table if exists t1;
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
insert into t1 SET A=NULL,B=1;
insert into t1 SET a=null,b=2;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 9bc716ee8b9..9ac88b42436 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -471,3 +471,38 @@ table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
drop table t1,t2,t3;
+CREATE TABLE t1 (
+`titre` char(80) NOT NULL default '',
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`date` datetime NOT NULL default '0000-00-00 00:00:00',
+`auteur` char(35) NOT NULL default '',
+`icone` tinyint(2) unsigned NOT NULL default '0',
+`lastauteur` char(35) NOT NULL default '',
+`nbrep` smallint(6) unsigned NOT NULL default '0',
+`dest` char(35) NOT NULL default '',
+`lu` tinyint(1) unsigned NOT NULL default '0',
+`vue` mediumint(8) unsigned NOT NULL default '0',
+`ludest` tinyint(1) unsigned NOT NULL default '0',
+`ouvert` tinyint(1) unsigned NOT NULL default '1',
+PRIMARY KEY (`numeropost`),
+KEY `date` (`date`),
+KEY `dest` (`dest`,`ludest`),
+KEY `auteur` (`auteur`,`lu`),
+KEY `auteur_2` (`auteur`,`date`),
+KEY `dest_2` (`dest`,`date`)
+) CHECKSUM=1;
+CREATE TABLE t2 (
+`numeropost` mediumint(8) unsigned NOT NULL default '0',
+`pseudo` char(35) NOT NULL default '',
+PRIMARY KEY (`numeropost`,`pseudo`),
+KEY `pseudo` (`pseudo`)
+);
+INSERT INTO t1 (titre,auteur,dest) VALUES ('test','joce','bug');
+INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug');
+SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
+titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest
+test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug
+SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
+titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest
+test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug
+drop table t1,t2;
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
new file mode 100644
index 00000000000..8b50f9a92e8
--- /dev/null
+++ b/mysql-test/r/repair.result
@@ -0,0 +1,7 @@
+drop table if exists t1;
+create table t1 SELECT 1,"table 1";
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 1
+test.t1 repair status OK
+drop table if exists t1;
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
new file mode 100644
index 00000000000..da2930f30c3
--- /dev/null
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -0,0 +1,17 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=MASTER_PORT;
+slave start;
+slave stop;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=SLAVE_PORT;
+slave start;
+flush logs;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.001 119 slave-bin.001 Yes Yes 0 0 79 119
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index b5719c920e6..01efce20e1d 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -8,7 +8,6 @@ slave stop;
reset master;
reset slave;
reset master;
-drop table if exists t1;
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL);
drop table t1;
@@ -37,6 +36,9 @@ show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs;
+slave start;
+flush logs;
+slave stop;
create table t1 (n int);
insert into t1 values (1);
drop table t1;
@@ -52,7 +54,6 @@ master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
master-bin.001 556 Exec_load 1 556 ;file_id=1
master-bin.001 579 Query 1 579 use `test`; drop table t1
master-bin.001 627 Rotate 1 627 master-bin.002;pos=4
-master-bin.001 668 Stop 1 668
show binlog events in 'master-bin.002';
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 4 Query 1 4 use `test`; create table t1 (n int)
@@ -68,32 +69,24 @@ Log_name
slave-bin.001
slave-bin.002
show binlog events in 'slave-bin.001' from 4;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
+slave-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
+slave-bin.001 172 Intvar 1 200 INSERT_ID=1
+slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
+slave-bin.001 263 Query 1 263 use test; drop table t1
+slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
+slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
+slave-bin.001 565 Exec_load 1 556 ;file_id=1
+slave-bin.001 588 Query 1 579 use test; drop table t1
+slave-bin.001 636 Rotate 2 636 slave-bin.002;pos=4
show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.002 4 Slave 2 627 host=127.0.0.1,port=MASTER_PORT,log=master-bin.002,pos=4
slave-bin.002 57 Query 1 4 use `test`; create table t1 (n int)
slave-bin.002 115 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.002 175 Query 1 122 use `test`; drop table t1
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 916 master-bin.002 Yes Yes 0 0 170 920
-show new master for slave with master_log_file='master-bin.001' and
-master_log_pos=4 and master_server_id=1;
-Log_name Log_pos
-slave-bin.001 132
-show new master for slave with master_log_file='master-bin.001' and
-master_log_pos=79 and master_server_id=1;
-Log_name Log_pos
-slave-bin.001 225
-show new master for slave with master_log_file='master-bin.001' and
-master_log_pos=311 and master_server_id=1;
-Log_name Log_pos
-slave-bin.001 439
-show new master for slave with master_log_file='master-bin.002' and
-master_log_pos=4 and master_server_id=1;
-Log_name Log_pos
-slave-bin.002 57
-show new master for slave with master_log_file='master-bin.002' and
-master_log_pos=122 and master_server_id=1;
-Log_name Log_pos
-slave-bin.002 223
+127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961
+show binlog events in 'slave-bin.005' from 4;
+Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/rpl_magic.result b/mysql-test/r/rpl_magic.result
deleted file mode 100644
index 743bef4a053..00000000000
--- a/mysql-test/r/rpl_magic.result
+++ /dev/null
@@ -1,37 +0,0 @@
-slave stop;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
-create table t1 ( n int);
-insert into t1 values (1),(2),(3),(4);
-insert into t1 values(5);
-select * from t1;
-n
-1
-2
-3
-4
-5
-select * from t1;
-n
-1
-2
-3
-4
-select * from t1;
-n
-1
-2
-3
-4
-select * from t1;
-n
-1
-2
-3
-4
-5
-drop table t1;
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
new file mode 100644
index 00000000000..6103a075684
--- /dev/null
+++ b/mysql-test/r/rpl_redirect.result
@@ -0,0 +1,43 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+SHOW SLAVE STATUS;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+SHOW SLAVE HOSTS;
+Server_id Host Port Rpl_recovery_rank Master_id
+2 127.0.0.1 SLAVE_PORT 2 1
+drop table if exists t1;
+create table t1 ( n int);
+insert into t1 values (1),(2),(3),(4);
+insert into t1 values(5);
+select * from t1;
+n
+1
+2
+3
+4
+5
+select * from t1;
+n
+1
+2
+3
+4
+select * from t1;
+n
+1
+2
+3
+4
+select * from t1;
+n
+1
+2
+3
+4
+5
+drop table t1;
+drop table t1;
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index d440e157ed4..63d5b0b63e1 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -2,12 +2,10 @@ slave start;
Could not initialize master info structure, check permisions on master.info
slave start;
Could not initialize master info structure, check permisions on master.info
-change master to master_host='127.0.0.1',master_port=MASTER_PORT,
-master_user='root';
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
Could not initialize master info
reset slave;
-change master to master_host='127.0.0.1',master_port=MASTER_PORT,
-master_user='root';
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
slave start;
drop table if exists t1, t2, t3, t4;
@@ -82,4 +80,4 @@ select count(*) from t3 where n >= 4;
count(*)
100
unlock tables;
-drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3,t4;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index bdef42aa5a8..4ccc40d3bd6 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1718,7 +1718,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET OPTION SQL_BIG_TABLES=1;
+SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -1731,7 +1731,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -1768,7 +1768,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET OPTION SQL_BIG_TABLES=1;
+SET SQL_BIG_TABLES=1;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -1781,7 +1781,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
@@ -1809,6 +1809,18 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
table type possible_keys key key_len ref rows Extra
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
+table type possible_keys key key_len ref rows Extra
+t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+t3 ref period period 4 t1.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+table type possible_keys key key_len ref rows Extra
+t3 index period period 4 NULL 41810
+t1 ref period period 4 t3.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+table type possible_keys key key_len ref rows Extra
+t1 index period period 4 NULL 41810
+t3 ref period period 4 t1.period 4181
select period from t1;
period
9410
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 44dacdd9bf1..ad390c9fa92 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1;
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 38c7b66dcb8..b0ea1b69e59 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (a set (' ','a','b') not null);
show create table t1;
Table Create Table
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index ff700f456ef..bacc3ec0176 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (t time);
insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index ab53d27e8f3..bd5e9f04992 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
CREATE TABLE t1 ( t timestamp);
SET TIMESTAMP=1234;
insert into t1 values(NULL);
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index c892d575ca0..25ddda88f48 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (y year,y2 year(2));
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
select * from t1;
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index a63db14b736..4eb34ebfd63 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -7,6 +7,7 @@ select 0x31+1,concat(0x31)+1,-0xf;
select x'31',X'ffff'+0;
x'31' X'ffff'+0
1 65535
+drop table if exists t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
@@ -15,7 +16,7 @@ table type possible_keys key key_len ref rows Extra
t1 const UNIQ UNIQ 8 const 1
drop table t1;
select x'hello';
-You have an error in your SQL syntax near 'x'hello'' at line 1
+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 'x'hello'' at line 1
select 0xfg;
Unknown column '0xfg' in 'field list'
create table t1 select 1 as x, 2 as xx;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 516204028fe..f708ddd2ee7 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -65,7 +65,7 @@ Variable_name Value
max_join_size 4294967295
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
-@@max_join_size @@max_join_size
+@@session.max_join_size @@global.max_join_size
1000 2000
select @@identity, length(@@version)>0;
@@identity length(@@version)>0
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index d77e98cc635..e5713718db0 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");
diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test
new file mode 100644
index 00000000000..5861c2fe0bf
--- /dev/null
+++ b/mysql-test/t/bdb-alter-table-1.test
@@ -0,0 +1,13 @@
+#
+# Test of problem when shutting down mysqld at once after ALTER TABLE
+#
+-- source include/have_bdb.inc
+drop table if exists t1;
+create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
+insert into t1 values(1, 't1',4,9);
+insert into t1 values(2, 'metatable',1,9);
+insert into t1 values(3, 'metaindex',1,9 );
+select * from t1;
+alter table t1 drop column test;
+
+# Now we do a reboot and continue with the next test
diff --git a/mysql-test/t/bdb-alter-table-2-master.opt b/mysql-test/t/bdb-alter-table-2-master.opt
new file mode 100644
index 00000000000..15ad73c500f
--- /dev/null
+++ b/mysql-test/t/bdb-alter-table-2-master.opt
@@ -0,0 +1,2 @@
+--skip-external-locking
+
diff --git a/mysql-test/t/bdb-alter-table-2.test b/mysql-test/t/bdb-alter-table-2.test
new file mode 100644
index 00000000000..a474efe42e1
--- /dev/null
+++ b/mysql-test/t/bdb-alter-table-2.test
@@ -0,0 +1,8 @@
+#
+# Note that this test uses tables from the previous test
+# This is to test that the table t1 survives a reboot of MySQL
+# The options in the -master.opt file are just there to force the reboot
+#
+-- source include/have_bdb.inc
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
index 7853b013ae6..fc2d91e20fe 100644
--- a/mysql-test/t/binary.test
+++ b/mysql-test/t/binary.test
@@ -2,6 +2,7 @@
# test sort,min and max on binary fields
#
+drop table if exists t1,t2;
create table t1 (name char(20) not null, primary key (name));
create table t2 (name char(20) binary not null, primary key (name));
insert into t1 values ("å");
@@ -31,3 +32,13 @@ select * from t1 where a="hello ";
select * from t1 where b="hello ";
select * from t1 where b="hello";
drop table t1;
+
+#
+# Test of binary and NULL
+#
+create table t1 (b char(8));
+insert into t1 values(NULL);
+select b from t1 where binary b like '';
+select b from t1 group by binary b like '';
+select b from t1 having binary b like '';
+drop table t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 0beb71aac48..47ee55620e4 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -107,3 +107,6 @@ show create table t1;
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
+create table t1 select if('2002'='2002','Y','N');
+select * from t1;
+drop table if exists t1;
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
index 6fbd99e3283..67111ea1734 100644
--- a/mysql-test/t/delayed.test
+++ b/mysql-test/t/delayed.test
@@ -3,6 +3,7 @@
# (Can't be tested with purify :( )
#
+drop table if exists t1;
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index e4503b0cf72..aaffea3c5a5 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -223,8 +223,7 @@ drop table t1;
# Test when using a not previously used column in ORDER BY
#
-CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
-DATETIME);
+CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
INSERT INTO t1 (email, infoID, dateentered) VALUES
@@ -242,3 +241,26 @@ SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
drop table t1,t2;
+
+#
+# test with table.* in DISTINCT
+#
+
+CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
+INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
+CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
+INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
+SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
+DROP TABLE IF EXISTS t1,t2;
+
+#
+# test with const_item in ORDER BY
+#
+
+CREATE TABLE t1 (a int primary key, b int, c int);
+INSERT t1 VALUES (1,2,3);
+CREATE TABLE t2 (a int primary key, b int, c int);
+INSERT t2 VALUES (3,4,5);
+SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
+DROP TABLE IF EXISTS t1,t2;
+
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
index a4f12886120..4ddcd53d5c8 100644
--- a/mysql-test/t/flush_table.test
+++ b/mysql-test/t/flush_table.test
@@ -4,6 +4,7 @@
# Test of flush table
#
+#drop table if exists t1;
#create table t1 (a int not null auto_increment primary key);
#insert into t1 values(0);
#lock table t1 read;
diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test
index abb1c8e8473..bcf7cbcc505 100644
--- a/mysql-test/t/fulltext_left_join.test
+++ b/mysql-test/t/fulltext_left_join.test
@@ -2,6 +2,7 @@
# Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr>
#
+drop table if exists t1, t2;
CREATE TABLE t1 (
id VARCHAR(255) NOT NULL PRIMARY KEY,
sujet VARCHAR(255),
diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test
index d5cb99ef0ee..3b60ee77db2 100644
--- a/mysql-test/t/fulltext_order_by.test
+++ b/mysql-test/t/fulltext_order_by.test
@@ -30,3 +30,17 @@ SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
drop table t1;
+
+#
+# reused boolean scan bug
+#
+CREATE TABLE t1 (
+ a INT AUTO_INCREMENT PRIMARY KEY,
+ message CHAR(20),
+ FULLTEXT(message)
+);
+INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
+drop table t1;
+
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index b97afc06340..57e9ae24e08 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -2,6 +2,7 @@
# simple test of all group functions
#
+drop table if exists t1,t2;
create table t1 (grp int, a bigint unsigned, c char(10) not null);
insert into t1 values (1,1,"a");
insert into t1 values (2,2,"b");
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 6830534e761..e5d42ec25c4 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -2,6 +2,7 @@
# test of IN (NULL)
#
+drop table if exists t1;
CREATE TABLE t1 (field char(1));
INSERT INTO t1 VALUES ('A'),(NULL);
SELECT * from t1 WHERE field IN (NULL);
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index daf5587b450..717b9c86a07 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -114,3 +114,12 @@ SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,mo
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1;
drop table t1;
+
+#
+# Test bug in AES_DECRYPT() when called with wrong argument
+#
+
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM;
+INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
+SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
+DROP TABLE t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
new file mode 100644
index 00000000000..7ee3b08cc3b
--- /dev/null
+++ b/mysql-test/t/grant.test
@@ -0,0 +1,41 @@
+#
+# Test that SSL options works properly
+#
+
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+show grants for mysqltest_1@localhost;
+grant delete on mysqltest.* to mysqltest_1@localhost;
+select * from mysql.user where user="mysqltest_1";
+show grants for mysqltest_1@localhost;
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+show grants for mysqltest_1@localhost;
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+show grants for mysqltest_1@localhost;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+
+#
+# Test that the new db privileges are stored/retrieved correctly
+#
+
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+flush privileges;
+show grants for mysqltest_1@localhost;
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+flush privileges;
+show grants for mysqltest_1@localhost;
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 2c912d94c70..0bca8dc5890 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -40,6 +40,15 @@ select a,t>0,c,i from t1;
drop table t1;
#
+# Test problem with bulk insert and auto_increment on second part keys
+#
+
+create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id));
+insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
+select * from t1;
+drop table t1;
+
+#
# Test of mysqld crash with fully qualified column names
#
diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test
index 75dded5d667..2cdb117128f 100644
--- a/mysql-test/t/key_primary.test
+++ b/mysql-test/t/key_primary.test
@@ -2,6 +2,7 @@
# test of primary key conversions
#
+drop table if exists t1;
create table t1 (t1 char(3) primary key);
insert into t1 values("ABC");
insert into t1 values("ABA");
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 53e9fd3393c..792ae956e2a 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -6,6 +6,7 @@
#
-- source include/not_embedded.inc
+drop table if exists t1;
#test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);
diff --git a/mysql-test/t/lowercase_table-master.opt b/mysql-test/t/lowercase_table-master.opt
new file mode 100644
index 00000000000..c718e2feb1b
--- /dev/null
+++ b/mysql-test/t/lowercase_table-master.opt
@@ -0,0 +1 @@
+--lower_case_table_names
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
new file mode 100644
index 00000000000..0d04e6c7df7
--- /dev/null
+++ b/mysql-test/t/lowercase_table.test
@@ -0,0 +1,14 @@
+#
+# Test of --lower-case-table-names
+#
+
+drop table if exists t1,t2,t3;
+create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
+INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
+SELECT * FROM t1;
+RENAME TABLE T1 TO T2;
+ALTER TABLE T2 ADD new_col int not null;
+ALTER TABLE T2 RENAME T3;
+show tables like 't_';
+drop table t3;
+
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 2479a68fc09..c69b87f325a 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -93,3 +93,24 @@ INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ce
REPAIR TABLE t1;
CHECK TABLE t1;
drop table t1;
+
+#
+# Test of OPTIMIZE of locked and modified tables
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES (1), (2), (3);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
+#
+# Test of creating table with too long key
+#
+
+--error 1071
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
+--error 1071
+ALTER TABLE t1 ADD INDEX t1 (a, b, c);
+DROP TABLE t1;
diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test
index 4629a08fd3f..3e0fc214d3e 100644
--- a/mysql-test/t/odbc.test
+++ b/mysql-test/t/odbc.test
@@ -8,6 +8,7 @@ select {fn length("hello")}, { date "1997-10-20" };
# Test retreiving row with last insert_id value.
#
+drop table if exists t1;
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
insert into t1 SET A=NULL,B=1;
insert into t1 SET a=null,b=2;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index baa3fe67f0b..0ee6f901aae 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -292,3 +292,41 @@ EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
drop table t1,t2,t3;
+
+#
+# Test of bug when doing an ORDER BY with const items
+#
+
+CREATE TABLE t1 (
+ `titre` char(80) NOT NULL default '',
+ `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `auteur` char(35) NOT NULL default '',
+ `icone` tinyint(2) unsigned NOT NULL default '0',
+ `lastauteur` char(35) NOT NULL default '',
+ `nbrep` smallint(6) unsigned NOT NULL default '0',
+ `dest` char(35) NOT NULL default '',
+ `lu` tinyint(1) unsigned NOT NULL default '0',
+ `vue` mediumint(8) unsigned NOT NULL default '0',
+ `ludest` tinyint(1) unsigned NOT NULL default '0',
+ `ouvert` tinyint(1) unsigned NOT NULL default '1',
+ PRIMARY KEY (`numeropost`),
+ KEY `date` (`date`),
+ KEY `dest` (`dest`,`ludest`),
+ KEY `auteur` (`auteur`,`lu`),
+ KEY `auteur_2` (`auteur`,`date`),
+ KEY `dest_2` (`dest`,`date`)
+) CHECKSUM=1;
+
+CREATE TABLE t2 (
+ `numeropost` mediumint(8) unsigned NOT NULL default '0',
+ `pseudo` char(35) NOT NULL default '',
+ PRIMARY KEY (`numeropost`,`pseudo`),
+ KEY `pseudo` (`pseudo`)
+);
+
+INSERT INTO t1 (titre,auteur,dest) VALUES ('test','joce','bug');
+INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug');
+SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
+SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
+drop table t1,t2;
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
new file mode 100644
index 00000000000..6d79014b23d
--- /dev/null
+++ b/mysql-test/t/repair.test
@@ -0,0 +1,8 @@
+#
+# Test of repair table
+#
+
+drop table if exists t1;
+create table t1 SELECT 1,"table 1";
+repair table t1 use_frm;
+drop table if exists t1;
diff --git a/mysql-test/t/rpl_flush_log_loop-master.opt b/mysql-test/t/rpl_flush_log_loop-master.opt
new file mode 100644
index 00000000000..4f6e0f3d00c
--- /dev/null
+++ b/mysql-test/t/rpl_flush_log_loop-master.opt
@@ -0,0 +1 @@
+-O max_binlog_size=1M --relay-log=$MYSQL_TEST_DIR/var/master-data/relay-log
diff --git a/mysql-test/t/rpl_flush_log_loop-master.sh b/mysql-test/t/rpl_flush_log_loop-master.sh
new file mode 100755
index 00000000000..9e56af99f5c
--- /dev/null
+++ b/mysql-test/t/rpl_flush_log_loop-master.sh
@@ -0,0 +1,5 @@
+rm -f $MYSQL_TEST_DIR/var/slave-data/*-bin.*
+rm -f $MYSQL_TEST_DIR/var/slave-data/master.info
+rm -f $MYSQL_TEST_DIR/var/slave-data/*.index
+
+
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.opt b/mysql-test/t/rpl_flush_log_loop-slave.opt
new file mode 100644
index 00000000000..d1373f139b1
--- /dev/null
+++ b/mysql-test/t/rpl_flush_log_loop-slave.opt
@@ -0,0 +1 @@
+-O max_binlog_size=1M --relay-log=$MYSQL_TEST_DIR/var/slave-data/relay-log
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.sh b/mysql-test/t/rpl_flush_log_loop-slave.sh
new file mode 100755
index 00000000000..b8814e059a9
--- /dev/null
+++ b/mysql-test/t/rpl_flush_log_loop-slave.sh
@@ -0,0 +1,4 @@
+rm -f $MYSQL_TEST_DIR/var/master-data/master.info
+rm -f $MYSQL_TEST_DIR/var/master-data/*-bin.*
+rm -f $MYSQL_TEST_DIR/var/master-data/*.index
+
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test
new file mode 100644
index 00000000000..c68fbb7111a
--- /dev/null
+++ b/mysql-test/t/rpl_flush_log_loop.test
@@ -0,0 +1,20 @@
+# Testing if "flush logs" command bouncing resulting in logs created in a loop
+# in case of bi-directional replication
+
+source include/master-slave.inc
+
+connection slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_user='root',
+ master_password='',master_port=$MASTER_MYPORT;
+slave start;
+connection master;
+slave stop;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval change master to master_host='127.0.0.1',master_user='root',
+ master_password='',master_port=$SLAVE_MYPORT;
+slave start;
+flush logs;
+sleep 5;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+show slave status;
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index 3514d435737..85782e78142 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -9,7 +9,6 @@ let $VERSION=`select version()`;
connection master;
reset master;
-drop table if exists t1;
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL);
drop table t1;
@@ -22,6 +21,19 @@ show binlog events from 79 limit 1;
show binlog events from 79 limit 2;
show binlog events from 79 limit 2,1;
flush logs;
+
+# Sync slave and force it to start on another binary log
+
+save_master_pos;
+connection slave;
+slave start;
+sync_with_master;
+flush logs;
+slave stop;
+connection master;
+
+# Create some entries for second log
+
create table t1 (n int);
insert into t1 values (1);
drop table t1;
@@ -35,23 +47,19 @@ slave start;
sync_with_master;
show master logs;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
-# We can't compare binlog from slave as the result differ between
-# machines based on where the LOAD DATA file is stored.
-disable_result_log;
-
show binlog events in 'slave-bin.001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
-enable_result_log;
show binlog events in 'slave-bin.002' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
-show new master for slave with master_log_file='master-bin.001' and
- master_log_pos=4 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.001' and
- master_log_pos=79 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.001' and
- master_log_pos=311 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.002' and
- master_log_pos=4 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.002' and
- master_log_pos=122 and master_server_id=1;
+
+# Need to recode the following
+
+#show new master for slave with master_log_file='master-bin.001' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.001' and master_log_pos=79 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.001' and master_log_pos=311 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.002' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.002' and master_log_pos=122 and master_server_id=1;
+
+--error 1220
+show binlog events in 'slave-bin.005' from 4;
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
index 371c5ba21ed..5280cb360dd 100644
--- a/mysql-test/t/rpl_mystery22.test
+++ b/mysql-test/t/rpl_mystery22.test
@@ -13,7 +13,7 @@ insert into t1 values(NULL);
insert into t1 values(NULL);
save_master_pos;
connection slave;
-sleep 1; # there is no way around this sleep - we have to wait until
+sleep 3; # there is no way around this sleep - we have to wait until
# the slave tries to run the query, fails and aborts slave thread
delete from t1 where n = 2;
slave start;
diff --git a/mysql-test/t/rpl_magic.test b/mysql-test/t/rpl_redirect.test
index c93add93d9d..4082542f295 100644
--- a/mysql-test/t/rpl_magic.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -1,3 +1,7 @@
+#
+# Test of automatic redirection of queries to master/slave.
+#
+
source include/master-slave.inc;
#first, make sure the slave has had enough time to register
@@ -7,6 +11,10 @@ sync_with_master;
#discover slaves
connection master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+SHOW SLAVE STATUS;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW SLAVE HOSTS;
rpl_probe;
#turn on master/slave query direction auto-magic
@@ -16,11 +24,12 @@ create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
disable_rpl_parse;
save_master_pos;
-enable_rpl_parse;
connection slave;
sync_with_master;
insert into t1 values(5);
connection master;
+enable_rpl_parse;
+# The first of the queries will be sent to the slave, the second to the master.
select * from t1;
select * from t1;
disable_rpl_parse;
@@ -28,3 +37,5 @@ select * from t1;
connection slave;
select * from t1;
drop table t1;
+connection master;
+drop table t1;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index cea2f9008dc..5d8f150cdea 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -20,12 +20,11 @@ system chmod 600 var/slave-data/master.info;
--error 1201
slave start;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
-!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
- master_user='root';
+# Will get error 13 on Unix systems becasue file is not readable
+!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
reset slave;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
-eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
- master_user='root';
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
connection master;
reset master;
connection slave;
@@ -140,7 +139,7 @@ select count(*) from t3 where n >= 4;
unlock tables;
#clean up
connection master;
-drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3,t4;
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 4dd833616d5..94806d44e37 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -1405,9 +1405,9 @@ drop table tmp;
# big table done
-SET OPTION SQL_BIG_TABLES=1;
+SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;
@@ -1416,9 +1416,9 @@ select distinct fld5 from t2 limit 10;
#
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET OPTION SQL_BIG_TABLES=1; # Force use of MyISAM
+SET SQL_BIG_TABLES=1; # Force use of MyISAM
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
#
@@ -1440,6 +1440,14 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
#
+# Some test with ORDER BY and limit
+#
+
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+
+#
# Search with a constant table.
#
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index 841ce06351e..eeb79f497fa 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -1,6 +1,7 @@
#
# Test of truncate
#
+drop table if exists t1;
create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1;
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 39bcbcbf75d..7f1a75e5dbd 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -2,6 +2,7 @@
# Test of SET with space
#
+drop table if exists t1;
create table t1 (a set (' ','a','b') not null);
show create table t1;
drop table t1;
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index fde93576510..2496ec36915 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -1,6 +1,7 @@
#
# testing of the TIME column type
#
+drop table if exists t1;
create table t1 (t time);
insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index a6169c03d3d..19af6b0c49c 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -2,6 +2,7 @@
# Test timestamp
#
+drop table if exists t1;
CREATE TABLE t1 ( t timestamp);
SET TIMESTAMP=1234;
insert into t1 values(NULL);
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index 70a3053f19b..8f4f23badb4 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -1,7 +1,7 @@
#
# Test year
#
-
+drop table if exists t1;
create table t1 (y year,y2 year(2));
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
select * from t1;
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 6d2660271ea..cc9ee99b7f9 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -10,6 +10,7 @@ select x'31',X'ffff'+0;
# Test of hex constants in WHERE:
#
+drop table if exists t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index e7cb1f46ec3..5fb536def71 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -1,7 +1,7 @@
#
# Test some warnings
#
-
+drop table if exists t1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");
diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c
index 3a11f1a247e..9c86a8072ef 100644
--- a/mysys/mf_fn_ext.c
+++ b/mysys/mf_fn_ext.c
@@ -19,10 +19,19 @@
#include <m_string.h>
/*
- Return a pointerto the extension of the filename
- The pointer points at the extension character (normally '.'))
- If there isn't any extension, the pointer points at the end
- ASCII(0) of the filename.
+ Return a pointer to the extension of the filename.
+
+ SYNOPSIS
+ fn_ext()
+ name Name of file
+
+ DESCRIPTION
+ The extension is defined as everything after the first extension character
+ (normally '.') after the directory name.
+
+ RETURN VALUES
+ Pointer to to the extension character. If there isn't any extension,
+ points at the end ASCII(0) of the filename.
*/
my_string fn_ext(const char *name)
@@ -40,6 +49,6 @@ my_string fn_ext(const char *name)
if (!(gpos=strrchr(name,FNLIBCHAR)))
gpos=name;
#endif
- pos=strrchr(gpos,FN_EXTCHAR);
+ pos=strchr(gpos,FN_EXTCHAR);
DBUG_RETURN (pos ? pos : strend(gpos));
} /* fn_ext */
diff --git a/mysys/my_aes.c b/mysys/my_aes.c
index 10ef62ae0a5..a3618e44b82 100644
--- a/mysys/my_aes.c
+++ b/mysys/my_aes.c
@@ -178,7 +178,7 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
char block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */
int rc; /* Result codes */
int num_blocks; /* Number of complete blocks */
- char pad_len; /* Pad size for the last block */
+ uint pad_len; /* Pad size for the last block */
int i;
if ((rc=my_aes_create_key(&aes_key,AES_DECRYPT,key,key_length)))
@@ -197,7 +197,8 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
}
rijndaelDecrypt(aes_key.rk, aes_key.nr, source, block);
- pad_len = block[AES_BLOCK_SIZE-1]; /* Use last char in the block as size */
+ /* Use last char in the block as size */
+ pad_len = (uint) (uchar) block[AES_BLOCK_SIZE-1];
if (pad_len > AES_BLOCK_SIZE)
return AES_BAD_DATA;
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 5b86fddbbdb..494e7ac559c 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -210,10 +210,16 @@ int handle_options(int *argc, char ***argv,
switch (i) {
case OPT_SKIP:
case OPT_DISABLE: /* fall through */
- optend= disabled_my_option;
+ /*
+ double negation is actually enable again,
+ for example: --skip-option=0 -> option = TRUE
+ */
+ optend= (optend && *optend == '0' && !(*(optend + 1))) ?
+ (char*) "1" : disabled_my_option;
break;
case OPT_ENABLE:
- optend= (char*) "1";
+ optend= (optend && *optend == '0' && !(*(optend + 1))) ?
+ disabled_my_option : (char*) "1";
break;
case OPT_MAXIMUM:
set_maximum_value= 1;
@@ -269,7 +275,7 @@ int handle_options(int *argc, char ***argv,
return EXIT_AMBIGUOUS_OPTION;
}
}
- if (must_be_var && !optp->value)
+ if (must_be_var && optp->var_type == GET_NO_ARG)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
@@ -278,7 +284,7 @@ int handle_options(int *argc, char ***argv,
}
if (optp->arg_type == NO_ARG)
{
- if (optend && special_used)
+ if (optend && optp->var_type != GET_BOOL)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 1e7cdd3a3b5..b273363aaf1 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -73,7 +73,7 @@ gptr my_memdup(const byte *from, uint length, myf MyFlags)
}
-my_string my_strdup(const char *from, myf MyFlags)
+char *my_strdup(const char *from, myf MyFlags)
{
gptr ptr;
uint length=(uint) strlen(from)+1;
@@ -81,3 +81,15 @@ my_string my_strdup(const char *from, myf MyFlags)
memcpy((byte*) ptr, (byte*) from,(size_t) length);
return((my_string) ptr);
}
+
+
+char *my_strdup_with_length(const byte *from, uint length, myf MyFlags)
+{
+ gptr ptr;
+ if ((ptr=my_malloc(length+1,MyFlags)) != 0)
+ {
+ memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ ((char*) ptr)[length]=0;
+ }
+ return((char*) ptr);
+}
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index 5cc22b6bfbc..e287930ff06 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -115,11 +115,15 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
(!lstat(filename,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
{
char *ptr;
+ DBUG_PRINT("info",("executing realpath"));
if ((ptr=realpath(filename,buff)))
+ {
strmake(to,ptr,FN_REFLEN-1);
+ }
else
{
/* Realpath didn't work; Use original name */
+ DBUG_PRINT("error",("realpath failed with errno: %d", errno));
my_errno=errno;
if (MyFlags & MY_WME)
my_error(EE_REALPATH, MYF(0), filename, my_errno);
diff --git a/mysys/queues.c b/mysys/queues.c
index c458c96e998..fe642131d74 100644
--- a/mysys/queues.c
+++ b/mysys/queues.c
@@ -174,10 +174,8 @@ static int queue_fix_cmp(QUEUE *queue, void **a, void **b)
}
/*
- Fix heap when every element was changed
- actually, it can be done in linear time,
- not in n*log(n), but some code (myisam/ft_boolean_search.c)
- requires a strict order here, not just a queue property
+ Fix heap when every element was changed,
+ actually, it can be done better, in linear time, not in n*log(n)
*/
void queue_fix(QUEUE *queue)
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 9615126f237..2b990448b08 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -529,12 +529,26 @@ gptr _my_memdup(const byte *from, uint length, const char *sFile, uint uLine,
} /*_my_memdup */
-my_string _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlags)
+char *_my_strdup(const char *from, const char *sFile, uint uLine,
+ myf MyFlags)
{
gptr ptr;
uint length=(uint) strlen(from)+1;
if ((ptr=_mymalloc(length,sFile,uLine,MyFlags)) != 0)
memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((my_string) ptr);
+ return((char*) ptr);
} /* _my_strdup */
+
+
+char *_my_strdup_with_length(const byte *from, uint length,
+ const char *sFile, uint uLine,
+ myf MyFlags)
+{
+ gptr ptr;
+ if ((ptr=_mymalloc(length+1,sFile,uLine,MyFlags)) != 0)
+ {
+ memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ ptr[length]=0;
+ }
+ return((char *) ptr);
+}
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 11e6fa97ab6..d1343d4c2d3 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -655,6 +655,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{
+ (*alrm)= &alarm->alarmed;
if (alarm_aborted)
{
alarm->alarmed.crono=0;
@@ -663,7 +664,6 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
if (!(alarm->alarmed.crono=SetTimer((HWND) NULL,0, sec*1000,
(TIMERPROC) NULL)))
return 1;
- (*alrm)= &alarm->alarmed;
return 0;
}
@@ -688,7 +688,7 @@ bool thr_got_alarm(thr_alarm_t *alrm_ptr)
void thr_end_alarm(thr_alarm_t *alrm_ptr)
{
thr_alarm_t alrm= *alrm_ptr;
- if (alrm->crono)
+ if (alrm && alrm->crono)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
diff --git a/scripts/explain_log.sh b/scripts/explain_log.sh
deleted file mode 100644
index c4a4ef21568..00000000000
--- a/scripts/explain_log.sh
+++ /dev/null
@@ -1,383 +0,0 @@
-#!@PERL@ -w
-use strict;
-use DBI;
-
-use Getopt::Long;
-$Getopt::Long::ignorecase=0;
-
-print "explain_log provided by http://www.mobile.de\n";
-print "=========== ================================\n";
-
-my $Param={};
-
-$Param->{host}='';
-$Param->{user}='';
-$Param->{password}='';
-$Param->{PrintError}=0;
-
-if (!GetOptions ('date|d:i' => \$Param->{ViewDate},
- 'host|h:s' => \$Param->{host},
- 'user|u:s' => \$Param->{user},
- 'password|p:s' => \$Param->{password},
- 'printerror|e:s' => \$Param->{PrintError},
- )) {
- ShowOptions();
-}
-else {
- $Param->{UpdateCount} = 0;
- $Param->{SelectCount} = 0;
- $Param->{IdxUseCount} = 0;
- $Param->{LineCount} = 0;
-
- $Param->{Init} = 0;
- $Param->{Field} = 0;
- $Param->{Refresh} = 0;
- $Param->{QueryCount} = 0;
- $Param->{Statistics} =0;
-
- $Param->{Query} = undef;
- $Param->{ALL} = undef ;
- $Param->{Comment} = undef ;
-
- @{$Param->{Rows}} = (qw|possible_keys key type|);
-
- if ($Param->{ViewDate}) {
- $Param->{View} = 0;
- }
- else {
- $Param->{View} = 1;
- }
-
- #print "Date=$Param->{ViewDate}, host=$Param->{host}, user=$Param->{user}, password=$Param->{password}\n";
-
- $Param->{dbh}=DBI->connect("DBI:mysql:host=$Param->{host}",$Param->{user},$Param->{password},{PrintError=>0});
- if (DBI::err()) {
- print "Error: " . DBI::errstr() . "\n";
- }
- else {
- $Param->{Start} = time;
- while(<STDIN>) {
- $Param->{LineCount} ++ ;
-
- if ($Param->{ViewDate} ) {
- if (m/^(\d{6})\s+\d{1,2}:\d\d:\d\d\s.*$/) { # get date
- #print "# $1 #\n";
- if ($1 == $Param->{ViewDate}) {
- $Param->{View} = 1;
- }
- else {
- $Param->{View} = 0;
- }
- }
- }
- if ($Param->{View} ) {
- #print "->>>$_";
-
- if (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Connect.+\s+on\s+(.*)$/i) { # get connection ID($2) and database($3)
- #print "C-$1--$2--$3------\n";
- RunQuery($Param);
- if (defined $3) {
- $Param->{CID}->{$2} = $3 ;
- #print "DB:$Param->{CID}->{$2} .. $2 .. $3 \n";
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Connect.+$/i) { # get connection ID($2) and database($3)
- #print "\n <<<<<<<<<<<<<<<<<<----------------------------<<<<<<<<<<<<<<<< \n";
- #print "Connect \n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Change user .*\s+on\s+(.*)$/i) { # get connection ID($2) and database($3)
- #print "C-$1--$2--$3------\n";
- RunQuery($Param);
- if (defined $3) {
- $Param->{CID}->{$2} = $3 ;
- #print "DB:$Param->{CID}->{$2} .. $2 .. $3 \n";
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Quit\s+$/i) { # remove connection ID($2) and querystring
- #print "Q-$1--$2--------\n";
- RunQuery($Param);
- delete $Param->{CID}->{$2} ;
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Query\s+(select.+)$/i) { # get connection ID($2) and querystring
- #print "S1-$1--$2--$3------\n";
- RunQuery($Param);
- unless ($Param->{CID}->{$2}) {
- #print "Error: No Database for Handle: $2 found\n";
- }
- else {
- $Param->{DB}=$Param->{CID}->{$2};
-
- my $s = "$3";
- $s =~ s/from\s/from $Param->{DB}./i;
- $Param->{Query}="EXPLAIN $s";
-
- #$s =~ m/from\s+(\w+[.]\w+)/i;
- #$Param->{tab} =$1;
- #print "-- $Param->{tab} -- $s --\n";
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Query\s+(update.+)$/i) { # get connection ID($2) and querystring
- #print "S2--$1--$2--$3------\n";
- RunQuery($Param);
- unless ($Param->{CID}->{$2}) {
- #print "Error: No Database for Handle: $2 found\n";
- }
- else {
- $Param->{DB}=$Param->{CID}->{$2};
-
- my $ud = $3;
- $ud =~ m/^update\s+(\w+).+(where.+)$/i;
- $Param->{Query} ="EXPLAIN SELECT * FROM $1 $2";
- $Param->{Query} =~ s/from\s/from $Param->{DB}./i;
-
- #$Param->{Query} =~ m/from\s+(\w+[.]\w+)/i;
- #$Param->{tab} =$1;
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Statistics\s+(.*)$/i) { # get connection ID($2) and info?
- $Param->{Statistics} ++;
- #print "Statistics--$1--$2--$3------\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Query\s+(.+)$/i) { # get connection ID($2)
- $Param->{QueryCount} ++;
- #print "Query-NULL $3\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Refresh\s+(.+)$/i) { # get connection ID($2)
- $Param->{Refresh} ++;
- #print "Refresh\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Init\s+(.+)$/i) { # get connection ID($2)
- $Param->{Init} ++;
- #print "Init $3\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Field\s+(.+)$/i) { # get connection ID($2)
- $Param->{Field} ++;
- #print "Field $3\n";
- RunQuery($Param);
- }
-
- elsif (m/^\s+(.+)$/ ) { # command could be some lines ...
- #print "multi-lined ($1)\n";
- my ($A)=$1;
- chomp $A;
- $Param->{Query} .= " $1";
- #print "multi-lined ($1)<<$Param->{Query}>>\n";
- }
-
-
- }
-
- }
-
- $Param->{dbh}->disconnect();
-
- if (1 == 0) {
- print "\nunclosed handles----------------------------------------\n";
- my $count=0;
- foreach (sort keys %{$Param->{CID}}) {
- print "$count | $_ : $Param->{CID}->{$_} \n";
- $count ++;
- }
- }
-
- print "\nIndex usage ------------------------------------\n";
- foreach my $t (sort keys %{$Param->{Data}}) {
- print "\nTable\t$t: ---\n";
- foreach my $k (sort keys %{$Param->{Data}->{$t}}) {
- print " count\t$k:\n";
- my %h = %{$Param->{Data}->{$t}->{$k}};
- foreach (sort {$h{$a} <=> $h{$b}} keys %h) {
- print " $Param->{Data}->{$t}->{$k}->{$_}\t$_\n";
- }
- }
- }
-
- $Param->{AllCount}=0;
- print "\nQueries causing table scans -------------------\n\n";
- foreach (@{$Param->{ALL}}) {
- $Param->{AllCount} ++;
- print "$_\n";
- }
- print "Sum: $Param->{AllCount} table scans\n";
-
- print "\nSummary ---------------------------------------\n\n";
- print "Select: \t$Param->{SelectCount} queries\n";
- print "Update: \t$Param->{UpdateCount} queries\n";
- print "\n";
-
- print "Init: \t$Param->{Init} times\n";
- print "Field: \t$Param->{Field} times\n";
- print "Refresh: \t$Param->{Refresh} times\n";
- print "Query: \t$Param->{QueryCount} times\n";
- print "Statistics:\t$Param->{Statistics} times\n";
- print "\n";
-
- print "Logfile: \t$Param->{LineCount} lines\n";
- print "Started: \t".localtime($Param->{Start})."\n";
- print "Finished: \t".localtime(time)."\n";
-
- }
-}
-
-
-###########################################################################
-#
-#
-#
-sub RunQuery {
- my $Param = shift ;
-
- if (defined $Param->{Query}) {
- if (defined $Param->{DB} ) {
-
- $Param->{Query} =~ m/from\s+(\w+[.]\w+|\w+)/i;
- $Param->{tab} =$1;
- #print "||$Param->{tab} -- $Param->{Query}\n";
-
- my $sth=$Param->{dbh}->prepare("USE $Param->{DB}");
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- $sth->execute();
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- $sth->finish();
-
- $sth=$Param->{dbh}->prepare($Param->{Query});
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- #print "$Param->{Query}\n";
- $sth->execute();
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "[$Param->{LineCount}]<<$Param->{Query}>>\n";}
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- my $row = undef;
- while ($row = $sth->fetchrow_hashref()) {
- $Param->{SelectCount} ++;
-
- if (defined $row->{Comment}) {
- push (@{$Param->{Comment}}, "$row->{Comment}; $_; $Param->{DB}; $Param->{Query}");
- }
- foreach (@{$Param->{Rows}}) {
- if (defined $row->{$_}) {
- #if (($_ eq 'type' ) and ($row->{$_} eq 'ALL')) {
- if ($row->{type} eq 'ALL') {
- push (@{$Param->{ALL}}, "$Param->{Query}");
- #print ">> $row->{$_} $_ $Param->{DB} $Param->{Query}\n";
- }
- $Param->{IdxUseCount} ++;
- $Param->{Data}->{$Param->{tab}}->{$_}->{$row->{$_}} ++;
- }
- }
- }
- }
- }
- }
- }
- $sth->finish();
- }
- $Param->{Query} = undef ;
- }
-}
-
-###########################################################################
-#
-#
-#
-sub ShowOptions {
- print <<EOF;
-Usage: $0 [OPTIONS] < LOGFILE
-
---date=YYMMDD select only entrys of date
--d=YYMMDD
---host=HOSTNAME db-host to ask
--h=HOSTNAME
---user=USERNAME db-user
--u=USERNAME
---password=PASSWORD password of db-user
--p=PASSWORD
-
-Read logfile from STDIN an try to EXPLAIN all SELECT statements. All UPDATE statements are rewritten to an EXPLAIN SELECT statement. The results of the EXPLAIN statement are collected and counted. All results with type=ALL are collected in an separete list. Results are printed to STDOUT.
-
-EOF
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-explain_log.pl
-
-Feed a mysqld general logfile (created with mysqld --log) back into mysql
-and collect statistics about index usage with EXPLAIN.
-
-=head1 DISCUSSION
-
-To optimize your indices, you have to know which ones are actually
-used and what kind of queries are causing table scans. Especially
-if you are generating your queries dynamically and you have a huge
-amount of queries going on, this isn't easy.
-
-Use this tool to take a look at the effects of your real life queries.
-Then add indices to avoid table scans and remove those which aren't used.
-
-=head1 USAGE
-
-explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] < logfile
-
---date=YYMMDD select only entrys of date
-
--d=YYMMDD
-
---host=HOSTNAME db-host to ask
-
--h=HOSTNAME
-
---user=USERNAME db-user
-
--u=USERNAME
-
---password=PASSWORD password of db-user
-
--p=PASSWORD
-
-=head1 EXAMPLE
-
-explain_log.pl --host=localhost --user=foo --password=bar < /var/lib/mysql/mobile.log
-
-=head1 AUTHOR
-
- Stefan Nitz
- Jan Willamowius <jan@mobile.de>, http://www.mobile.de
-
-=head1 RECRUITING
-
-If you are looking for a MySQL or Perl job, take a look at http://www.mobile.de
-and send me an email with your resume (you must be speaking German!).
-
-=head1 SEE ALSO
-
-mysql documentation
-
-=cut
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 2617a7971dc..e5d7f20c6df 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -54,10 +54,13 @@ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \
chmod o-rwx $BASE/data $BASE/data/*
-for i in sql/ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \
- Docs/manual.html Docs/manual.txt Docs/manual_toc.html
+for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \
+ LICENSE Docs/manual.html Docs/manual.txt Docs/manual_toc.html
do
- $CP $i $BASE
+ if [ -f $i ]
+ then
+ $CP $i $BASE
+ fi
done
for i in extra/comp_err extra/replace extra/perror extra/resolveip \
diff --git a/scripts/mysql_explain_log.sh b/scripts/mysql_explain_log.sh
index d7f6bb97b40..c4a4ef21568 100644
--- a/scripts/mysql_explain_log.sh
+++ b/scripts/mysql_explain_log.sh
@@ -279,7 +279,7 @@ sub RunQuery {
if (defined $row->{$_}) {
#if (($_ eq 'type' ) and ($row->{$_} eq 'ALL')) {
if ($row->{type} eq 'ALL') {
- push (@{$Param->{ALL}}, "$row->{$_} $_ $Param->{DB} $Param->{Query}");
+ push (@{$Param->{ALL}}, "$Param->{Query}");
#print ">> $row->{$_} $_ $Param->{DB} $Param->{Query}\n";
}
$Param->{IdxUseCount} ++;
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
index a492066235b..247e3399b8b 100644
--- a/scripts/mysql_fix_privilege_tables.sh
+++ b/scripts/mysql_fix_privilege_tables.sh
@@ -137,7 +137,7 @@ EOF
echo ""
#
-# Change the user table to MySQL 4.0 format
+# Change the user,db and host tables to MySQL 4.0 format
#
echo "Adding new fields used by MySQL 4.0.2 to the privilege tables"
@@ -160,7 +160,7 @@ then
echo ""
echo "Updating new privileges in MySQL 4.0.2 from old ones"
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
- update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv;
+ update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>"";
END_OF_DATA
echo ""
fi
@@ -174,3 +174,16 @@ add max_questions int(11) NOT NULL AFTER x509_subject,
add max_updates int(11) unsigned NOT NULL AFTER max_questions,
add max_connections int(11) unsigned NOT NULL AFTER max_updates;
END_OF_DATA
+
+#
+# Add Create_tmp_table_priv and Lock_tables_priv to db and host
+#
+
+@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
+alter table db
+add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
+alter table host
+add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
+END_OF_DATA
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 6ac54256124..2f27f5d7c1a 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -171,13 +171,15 @@ then
c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ 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 comment='Database privileges';"
- i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');
- INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');"
+ i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+ INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');"
fi
if test ! -f $mdata/host.frm
@@ -197,6 +199,8 @@ then
c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ 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 comment='Host privileges; Merged with database privileges';"
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 5527c345078..5e023a68de9 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -133,6 +133,11 @@ lex_hash.h: lex.h gen_lex_hash.cc sql_yacc.h
# Hack to ensure that lex_hash.h is built early
sql_lex.o: lex_hash.h
+# For testing of udf_example.so; Works on platforms with gcc
+# (This is not part of our build process but only provided as an example)
+udf_example.so: udf_example.cc
+ $(CXXCOMPILE) -shared -o $@ $<
+
#distclean:
# rm -f lex_hash.h
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 398ba4875d3..4d877c92dba 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -379,13 +379,18 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
{
if (write_keys(param,sort_keys,idx,buffpek_pointers,tempfile))
DBUG_RETURN(HA_POS_ERROR);
- idx=0; indexpos++;
+ idx=0;
if (param->ref_length == param->sort_length &&
my_b_tell(tempfile)/param->sort_length >= param->max_rows)
{
+ /*
+ We are writing the result index file and have found all
+ rows that we need. Abort the sort and return the result.
+ */
error=HA_ERR_END_OF_FILE;
break; /* Found enough records */
}
+ indexpos++;
}
make_sortkey(param,sort_keys[idx++],ref_pos);
}
@@ -400,7 +405,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
file->print_error(error,MYF(ME_ERROR | ME_WAITTANG)); /* purecov: inspected */
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
}
- if (indexpos &&
+ if (indexpos && idx &&
write_keys(param,sort_keys,idx,buffpek_pointers,tempfile))
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
DBUG_RETURN(my_b_inited(tempfile) ?
@@ -767,7 +772,11 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
}
buffpek->key+=sort_length;
buffpek->mem_count--;
- max_rows--;
+ if (!--max_rows)
+ {
+ error=0; /* purecov: inspected */
+ goto end; /* purecov: inspected */
+ }
queue_replaced(&queue); // Top element has been used
}
else
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index aa675cfffea..504f5262bf3 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -41,13 +41,14 @@ class ha_heap: public handler
{
return (HA_READ_RND_SAME | HA_NO_INDEX | HA_KEYPOS_TO_RNDPOS |
HA_NO_BLOBS | HA_NULL_KEY | HA_REC_NOT_IN_SEQ |
- HA_NOT_READ_PREFIX_LAST | HA_NO_AUTO_INCREMENT);
+ HA_NO_AUTO_INCREMENT);
}
ulong index_flags(uint inx) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER) :
- (HA_ONLY_WHOLE_INDEX | HA_WRONG_ASCII_ORDER));
+ (HA_ONLY_WHOLE_INDEX | HA_WRONG_ASCII_ORDER |
+ HA_NOT_READ_PREFIX_LAST));
}
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MAX_KEY; }
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 65aaa63f7db..b684d9dd4dd 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/*
- This file defines the InnoDB handler: the interface between MySQL and InnoDB */
+/* This file defines the InnoDB handler: the interface between MySQL and
+InnoDB */
/* TODO list for the InnoDB handler:
- Ask Monty if strings of different languages can exist in the same
@@ -28,6 +28,8 @@
#include "mysql_priv.h"
#include "slave.h"
+#include "sql_cache.h"
+
#ifdef HAVE_INNOBASE_DB
#include <m_ctype.h>
#include <assert.h>
@@ -100,7 +102,7 @@ char* innobase_unix_file_flush_method = NULL;
/* Below we have boolean-valued start-up parameters, and their default
values */
-my_bool innobase_flush_log_at_trx_commit = FALSE;
+uint innobase_flush_log_at_trx_commit = 0;
my_bool innobase_log_archive = FALSE;
my_bool innobase_use_native_aio = FALSE;
my_bool innobase_fast_shutdown = TRUE;
@@ -404,8 +406,180 @@ ha_innobase::update_thd(
return(0);
}
-/* The code here appears for documentational purposes only. Not used
-or tested yet. Will be used in 4.1. */
+
+/* BACKGROUND INFO: HOW THE MYSQL QUERY CACHE WORKS WITH INNODB
+ ------------------------------------------------------------
+
+1) The use of the query cache for TBL is disabled when there is an
+uncommitted change to TBL.
+
+2) When a change to TBL commits, InnoDB stores the current value of
+its global trx id counter, let us denote it by INV_TRX_ID, to the table object
+in the InnoDB data dictionary, and does only allow such transactions whose
+id >= INV_TRX_ID to use the query cache.
+
+3) When InnoDB does an INSERT/DELETE/UPDATE to a table TBL, or an implicit
+modification because an ON DELETE CASCADE, we invalidate the MySQL query cache
+of TBL immediately.
+
+How this is implemented inside InnoDB:
+
+1) Since every modification always sets an IX type table lock on the InnoDB
+table, it is easy to check if there can be uncommitted modifications for a
+table: just check if there are locks in the lock list of the table.
+
+2) When a transaction inside InnoDB commits, it reads the global trx id
+counter and stores the value INV_TRX_ID to the tables on which it had a lock.
+
+3) If there is an implicit table change from ON DELETE CASCADE or SET NULL,
+InnoDB calls an invalidate method for the MySQL query cache for that table.
+
+How this is implemented inside sql_cache.cc:
+
+1) The query cache for an InnoDB table TBL is invalidated immediately at an
+INSERT/UPDATE/DELETE, just like in the case of MyISAM. No need to delay
+invalidation to the transaction commit.
+
+2) To store or retrieve a value from the query cache of an InnoDB table TBL,
+any query must first ask InnoDB's permission. We must pass the thd as a
+parameter because InnoDB will look at the trx id, if any, associated with
+that thd.
+
+3) Use of the query cache for InnoDB tables is now allowed also when
+AUTOCOMMIT==0 or we are inside BEGIN ... COMMIT. Thus transactions no longer
+put restrictions on the use of the query cache.
+*/
+
+/**********************************************************************
+The MySQL query cache uses this to check from InnoDB if the query cache at
+the moment is allowed to operate on an InnoDB table. The SQL query must
+be a non-locking SELECT.
+
+The query cache is allowed to operate on certain query only if this function
+returns TRUE for all tables in the query.
+
+If thd is not in the autocommit state, this function also starts a new
+transaction for thd if there is no active trx yet, and assigns a consistent
+read view to it if there is no read view yet. */
+
+my_bool
+innobase_query_caching_of_table_permitted(
+/*======================================*/
+ /* out: TRUE if permitted, FALSE if not;
+ note that the value FALSE does not mean
+ we should invalidate the query cache:
+ invalidation is called explicitly */
+ THD* thd, /* in: thd of the user who is trying to
+ store a result to the query cache or
+ retrieve it */
+ char* full_name, /* in: concatenation of database name,
+ the null character '\0', and the table
+ name */
+ uint full_name_len) /* in: length of the full name, i.e.
+ len(dbname) + len(tablename) + 1 */
+{
+ ibool is_autocommit;
+ trx_t* trx;
+ char* ptr;
+ char norm_name[1000];
+
+ ut_a(full_name_len < 999);
+
+ if (thd->variables.tx_isolation == ISO_SERIALIZABLE) {
+ /* In the SERIALIZABLE mode we add LOCK IN SHARE MODE to every
+ plain SELECT */
+
+ return((my_bool)FALSE);
+ }
+
+ trx = (trx_t*) thd->transaction.all.innobase_tid;
+
+ if (trx == NULL) {
+ trx = check_trx_exists(thd);
+ }
+
+ innobase_release_stat_resources(trx);
+
+ if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
+
+ is_autocommit = TRUE;
+ } else {
+ is_autocommit = FALSE;
+
+ }
+
+ if (is_autocommit && trx->conc_state == TRX_NOT_STARTED) {
+ /* We are going to retrieve the query result from the
+ query cache. This cannot be a store operation because then
+ we would have started the trx already.
+
+ We can imagine we instantaneously serialize
+ this consistent read trx to the current trx id counter.
+ If trx2 would have changed the tables of a query
+ result stored in the cache, and trx2 would have already
+ committed, making the result obsolete, then trx2 would have
+ already invalidated the cache. Thus we can trust the result
+ in the cache is ok for this query. */
+
+ return((my_bool)TRUE);
+ }
+
+ /* Normalize the table name to InnoDB format */
+
+ memcpy(norm_name, full_name, full_name_len);
+
+ norm_name[strlen(norm_name)] = '/'; /* InnoDB uses '/' as the
+ separator between db and table */
+ norm_name[full_name_len] = '\0';
+#ifdef __WIN__
+ /* Put to lower case */
+
+ ptr = norm_name;
+
+ while (*ptr != '\0') {
+ *ptr = tolower(*ptr);
+ ptr++;
+ }
+#endif
+ if (row_search_check_if_query_cache_permitted(trx, norm_name)) {
+
+ printf("Query cache for %s permitted\n", norm_name);
+
+ return((my_bool)TRUE);
+ }
+
+ printf("Query cache for %s NOT permitted\n", norm_name);
+
+ return((my_bool)FALSE);
+}
+
+extern "C" {
+/*********************************************************************
+Invalidates the MySQL query cache for the table.
+NOTE that the exact prototype of this function has to be in
+/innobase/row/row0ins.c! */
+
+void
+innobase_invalidate_query_cache(
+/*============================*/
+ trx_t* trx, /* in: transaction which modifies the table */
+ char* full_name, /* in: concatenation of database name, null
+ char '\0', table name, null char'\0';
+ NOTE that in Windows this is always
+ in LOWER CASE! */
+ ulint full_name_len) /* in: full name length where also the null
+ chars count */
+{
+ /* Argument TRUE below means we are using transactions */
+#ifdef HAVE_QUERY_CACHE
+ query_cache.invalidate((THD*)(trx->mysql_thd),
+ (const char*)full_name,
+ (uint32)full_name_len,
+ TRUE);
+#endif
+}
+}
+
/*********************************************************************
Call this when you have opened a new table handle in HANDLER, before you
call index_read_idx() etc. Actually, we can let the cursor stay open even
@@ -665,20 +839,20 @@ innobase_commit_low(
/*================*/
trx_t* trx) /* in: transaction handle */
{
- if (current_thd->slave_thread)
- {
- /* Update the replication position info inside InnoDB */
+ if (current_thd->slave_thread) {
+ /* Update the replication position info inside InnoDB */
#ifdef NEED_TO_BE_FIXED
- trx->mysql_relay_log_file_name= active_mi->rli.log_file_name;
- trx->mysql_relay_log_pos= active_mi->rli.relay_log_pos;
+ trx->mysql_relay_log_file_name = active_mi->rli.log_file_name;
+ trx->mysql_relay_log_pos = active_mi->rli.relay_log_pos;
#endif
- trx->mysql_master_log_file_name= active_mi->rli.master_log_name;
- trx->mysql_master_log_pos= ((ib_longlong)
+ trx->mysql_master_log_file_name
+ = active_mi->rli.master_log_name;
+ trx->mysql_master_log_pos = ((ib_longlong)
(active_mi->rli.master_log_pos +
active_mi->rli.event_len +
active_mi->rli.pending));
- }
- trx_commit_for_mysql(trx);
+ }
+ trx_commit_for_mysql(trx);
}
/*********************************************************************
@@ -690,7 +864,8 @@ innobase_commit(
/* out: 0 or error number */
THD* thd, /* in: MySQL thread handle of the user for whom
the transaction should be committed */
- void* trx_handle)/* in: InnoDB trx handle or NULL: NULL means
+ void* trx_handle)/* in: InnoDB trx handle or
+ &innodb_dummy_stmt_trx_handle: the latter means
that the current SQL statement ended, and we should
mark the start of a new statement with a savepoint */
{
@@ -714,6 +889,7 @@ innobase_commit(
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
innobase_commit_low(trx);
+ thd->transaction.all.innodb_active_trans=0;
}
/* Release possible statement level resources */
@@ -770,7 +946,9 @@ innobase_rollback(
/* out: 0 or error number */
THD* thd, /* in: handle to the MySQL thread of the user
whose transaction should be rolled back */
- void* trx_handle)/* in: InnoDB trx handle or a dummy stmt handle */
+ void* trx_handle)/* in: InnoDB trx handle or a dummy stmt handle;
+ the latter means we roll back the latest SQL
+ statement */
{
int error = 0;
trx_t* trx;
@@ -794,6 +972,7 @@ innobase_rollback(
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
error = trx_rollback_for_mysql(trx);
+ thd->transaction.all.innodb_active_trans=0;
} else {
error = trx_rollback_last_sql_stat_for_mysql(trx);
}
@@ -974,7 +1153,9 @@ Cannot find table %s from the internal data dictionary\n\
of InnoDB though the .frm file for the table exists. Maybe you\n\
have deleted and recreated InnoDB data files but have forgotten\n\
to delete the corresponding .frm files of InnoDB tables, or you\n\
-have moved .frm files to another database?",
+have moved .frm files to another database?\n\
+Look from section 15.1 of http://www.innodb.com/ibman.html\n\
+how you can resolve the problem.\n",
norm_name);
free_share(share);
@@ -1189,11 +1370,11 @@ innobase_mysql_cmp(
(const char*) a, a_length,
(const char*) b, b_length);
if (ret < 0) {
- return(-1);
+ return(-1);
} else if (ret > 0) {
- return(1);
+ return(1);
} else {
- return(0);
+ return(0);
}
default:
assert(0);
@@ -1496,6 +1677,8 @@ ha_innobase::write_row(
int error;
longlong auto_inc;
longlong dummy;
+ ibool incremented_auto_inc_for_stat = FALSE;
+ ibool incremented_auto_inc_counter = FALSE;
DBUG_ENTER("ha_innobase::write_row");
@@ -1566,6 +1749,7 @@ ha_innobase::write_row(
assign sequential values from the counter. */
auto_inc_counter_for_this_stat++;
+ incremented_auto_inc_for_stat = TRUE;
auto_inc = auto_inc_counter_for_this_stat;
@@ -1614,7 +1798,12 @@ ha_innobase::write_row(
}
}
+ /* The following call gets the value of the auto-inc
+ counter of the table and increments it by 1 */
+
auto_inc = dict_table_autoinc_get(prebuilt->table);
+ incremented_auto_inc_counter = TRUE;
+
srv_conc_exit_innodb(prebuilt->trx);
/* We can give the new value for MySQL to place in
@@ -1651,6 +1840,20 @@ ha_innobase::write_row(
srv_conc_exit_innodb(prebuilt->trx);
+ if (error != DB_SUCCESS) {
+ /* If the insert did not succeed we restore the value of
+ the auto-inc counter we used; note that this behavior was
+ introduced only in version 4.0.4 */
+
+ if (incremented_auto_inc_counter) {
+ dict_table_autoinc_decrement(prebuilt->table);
+ }
+
+ if (incremented_auto_inc_for_stat) {
+ auto_inc_counter_for_this_stat--;
+ }
+ }
+
prebuilt->trx->ignore_duplicates_in_insert = FALSE;
error = convert_error_code_to_mysql(error, user_thd);
@@ -1978,7 +2181,16 @@ convert_search_mode_to_innobase(
case HA_READ_AFTER_KEY: return(PAGE_CUR_G);
case HA_READ_BEFORE_KEY: return(PAGE_CUR_L);
case HA_READ_PREFIX: return(PAGE_CUR_GE);
- case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE);
+ case HA_READ_PREFIX_LAST:
+ /* ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Warning: Using HA_READ_PREFIX_LAST\n"); */
+ return(PAGE_CUR_LE);
+
+ /* InnoDB does not yet support ..PREFIX_LAST!
+ We have to add a new search flag
+ PAGE_CUR_LE_OR_PREFIX to InnoDB. */
+
/* the above PREFIX flags mean that the last
field in the key value may just be a prefix
of the complete fixed length field */
@@ -2053,7 +2265,10 @@ ha_innobase::index_read(
start or end of index; this can
also contain an InnoDB row id, in
which case key_len is the InnoDB
- row id length */
+ row id length; the key value can
+ also be a prefix of a full key value,
+ and the last column can be a prefix
+ of a full column */
uint key_len,/* in: key value length */
enum ha_rkey_function find_flag)/* in: search flags from my_base.h */
{
@@ -2143,24 +2358,24 @@ ha_innobase::index_read(
DBUG_RETURN(error);
}
-
-/*
- The following functions works like index_read, but it find the last
- row with the current index prefix.
- This code is disabled until Heikki has verified that InnoDB support the
- HA_READ_PREFIX_LAST flag and removed the HA_NOT_READ_PREFIX_LAST
- flag from ha_innodb.h
-*/
+/***********************************************************************
+The following functions works like index_read, but it find the last
+row with the current key value or prefix. */
int
-ha_innobase::index_read_last(mysql_byte *buf,
- const mysql_byte *key_ptr,
- uint key_len)
+ha_innobase::index_read_last(
+/*=========================*/
+ /* out: 0, HA_ERR_KEY_NOT_FOUND, or an
+ error code */
+ mysql_byte* buf, /* out: fetched row */
+ const mysql_byte* key_ptr, /* in: key value, or a prefix of a full
+ key value */
+ uint key_len) /* in: length of the key val or prefix
+ in bytes */
{
- return index_read(buf, key_ptr, key_len, HA_READ_PREFIX_LAST);
+ return(index_read(buf, key_ptr, key_len, HA_READ_PREFIX_LAST));
}
-
/************************************************************************
Changes the active index of a handle. */
@@ -3310,7 +3525,7 @@ ha_innobase::update_table_comment(
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
uint length = strlen(comment);
- char* str = my_malloc(length + 550, MYF(0));
+ char* str = my_malloc(length + 16500, MYF(0));
char* pos;
/* Warning: since it is not sure that MySQL calls external_lock
@@ -3332,10 +3547,12 @@ ha_innobase::update_table_comment(
(pos,"InnoDB free: %lu kB",
(ulong) innobase_get_free_space()));
- /* We assume 450 - length bytes of space to print info */
+ /* We assume 16000 - length bytes of space to print info; the limit
+ 16000 bytes is arbitrary, and MySQL could handle at least 64000
+ bytes */
- if (length < 450) {
- dict_print_info_on_foreign_keys(FALSE, pos, 450 - length,
+ if (length < 16000) {
+ dict_print_info_on_foreign_keys(FALSE, pos, 16000 - length,
prebuilt->table);
}
@@ -3433,9 +3650,50 @@ ha_innobase::reset(void)
}
/**********************************************************************
+When we create a temporary table inside MySQL LOCK TABLES, MySQL will
+not call external_lock for the temporary table when it uses it. Instead,
+it will call this function. */
+
+int
+ha_innobase::start_stmt(
+/*====================*/
+ /* out: 0 or error code */
+ THD* thd) /* in: handle to the user thread */
+{
+ row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
+ trx_t* trx;
+
+ update_thd(thd);
+
+ trx = prebuilt->trx;
+
+ innobase_release_stat_resources(trx);
+ trx_mark_sql_stat_end(trx);
+
+ auto_inc_counter_for_this_stat = 0;
+ prebuilt->sql_stat_start = TRUE;
+ prebuilt->hint_no_need_to_fetch_extra_cols = TRUE;
+ prebuilt->read_just_key = 0;
+
+ if (prebuilt->select_lock_type == LOCK_NONE) {
+ /* This handle is for a temporary table created inside
+ this same LOCK TABLES; since MySQL does NOT call external_lock
+ in this case, we must use x-row locks inside InnoDB to be
+ prepared for an update of a row */
+
+ prebuilt->select_lock_type = LOCK_X;
+ }
+
+ thd->transaction.all.innodb_active_trans = 1;
+
+ return(0);
+}
+
+/**********************************************************************
As MySQL will execute an external lock for every new table it uses when it
-starts to process an SQL statement, we can use this function to store the
-pointer to the THD in the handle. We will also use this function to communicate
+starts to process an SQL statement (an exception is when MySQL calls
+start_stmt for the handle) we can use this function to store the pointer to
+the THD in the handle. We will also use this function to communicate
to InnoDB that a new SQL statement has started and that we must store a
savepoint to our transaction handle, so that we are able to roll back
the SQL statement in case of an error. */
@@ -3443,6 +3701,7 @@ the SQL statement in case of an error. */
int
ha_innobase::external_lock(
/*=======================*/
+ /* out: 0 or error code */
THD* thd, /* in: handle to the user thread */
int lock_type) /* in: lock type */
{
@@ -3507,7 +3766,6 @@ ha_innobase::external_lock(
& (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
innobase_commit(thd, trx);
- thd->transaction.all.innodb_active_trans=0;
}
}
}
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 2addd957c8c..357fb31b5e3 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -96,7 +96,7 @@ class ha_innobase: public handler
ulong index_flags(uint idx) const
{
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
- HA_NOT_READ_PREFIX_LAST | HA_KEY_READ_ONLY);
+ HA_KEY_READ_ONLY | HA_NOT_READ_PREFIX_LAST);
}
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MAX_KEY; }
@@ -146,6 +146,8 @@ class ha_innobase: public handler
int extra(enum ha_extra_function operation);
int reset(void);
int external_lock(THD *thd, int lock_type);
+ int start_stmt(THD *thd);
+
void position(byte *record);
ha_rows records_in_range(int inx,
const byte *start_key,uint start_key_len,
@@ -170,6 +172,7 @@ class ha_innobase: public handler
extern bool innodb_skip;
extern uint innobase_init_flags, innobase_lock_type;
+extern uint innobase_flush_log_at_trx_commit;
extern ulong innobase_cache_size;
extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
extern long innobase_lock_scan_time;
@@ -182,7 +185,7 @@ extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method;
/* The following variables have to be my_bool for SHOW VARIABLES to work */
-extern my_bool innobase_flush_log_at_trx_commit, innobase_log_archive,
+extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_fast_shutdown;
extern TYPELIB innobase_lock_typelib;
@@ -203,3 +206,5 @@ int innobase_close_connection(THD *thd);
int innobase_drop_database(char *path);
int innodb_show_status(THD* thd);
+my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
+ uint full_name_len);
diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc
index 55d24f5edb9..052e6a4b9ec 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -244,7 +244,9 @@ int ha_isam::reset(void)
int ha_isam::external_lock(THD *thd, int lock_type)
{
- return nisam_lock_database(file,lock_type);
+ if (!table->tmp_table)
+ return nisam_lock_database(file,lock_type);
+ return 0;
}
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index bbe75a74db8..c936a15164a 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -33,9 +33,9 @@ class ha_isammrg: public handler
const char *table_type() const { return "MRG_ISAM"; }
const char **bas_ext() const;
ulong table_flags() const { return (HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS |
- HA_NOT_READ_PREFIX_LAST |
HA_REC_NOT_IN_SEQ); }
- ulong index_flags(uint idx) const { return 0; }
+ ulong index_flags(uint idx) const { return HA_NOT_READ_PREFIX_LAST; }
+
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return 0; }
uint max_key_parts() const { return 0; }
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index e9ef5b4ce12..4aae044148b 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -571,11 +571,12 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
}
if (!optimize ||
+ memcmp(file->state, & share->state.state, sizeof(MI_STATUS_INFO)) ||
((file->state->del || share->state.split != file->state->records) &&
(!(param.testflag & T_QUICK) ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{
- ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
+ ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
((ulonglong) 1L << share->base.keys)-1 :
share->state.key_map);
uint testflag=param.testflag;
@@ -661,7 +662,15 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
}
-/* Deactive all not unique index that can be recreated fast */
+/*
+ Deactive all not unique index that can be recreated fast
+
+ SYNOPSIS
+ deactivate_non_unique_index()
+ rows Rows to be inserted
+ 0 if we don't know
+ HA_POS_ERROR if we want to disable all keys
+*/
void ha_myisam::deactivate_non_unique_index(ha_rows rows)
{
@@ -674,9 +683,12 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows)
mi_extra(file, HA_EXTRA_NO_KEYS, 0);
else
{
- mi_disable_non_unique_index(file,rows);
+ /* Only disable old index if the table was empty */
+ if (file->state->records == 0)
+ mi_disable_non_unique_index(file,rows);
ha_myisam::extra_opt(HA_EXTRA_BULK_INSERT_BEGIN,
current_thd->variables.bulk_insert_buff_size);
+ table->bulk_insert= 1;
}
}
enable_activate_all_index=1;
@@ -694,6 +706,7 @@ bool ha_myisam::activate_all_index(THD *thd)
DBUG_ENTER("activate_all_index");
mi_extra(file, HA_EXTRA_BULK_INSERT_END, 0);
+ table->bulk_insert= 0;
if (enable_activate_all_index &&
share->state.key_map != set_bits(ulonglong, share->base.keys))
{
@@ -962,7 +975,9 @@ int ha_myisam::delete_table(const char *name)
int ha_myisam::external_lock(THD *thd, int lock_type)
{
- return mi_lock_database(file,lock_type);
+ if (!table->tmp_table)
+ return mi_lock_database(file,lock_type);
+ return 0;
}
@@ -1201,6 +1216,10 @@ longlong ha_myisam::get_auto_increment()
return auto_increment_value;
}
+ if (table->bulk_insert)
+ mi_extra(file, HA_EXTRA_BULK_INSERT_FLUSH,
+ (void*) &table->next_number_index);
+
longlong nr;
int error;
byte key[MI_MAX_KEY_LENGTH];
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index ee72216baa5..c35bf657445 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -53,15 +53,23 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
myrg_extra(file,HA_EXTRA_WAIT_LOCK,0);
+
if (table->reclength != mean_rec_length && mean_rec_length)
{
DBUG_PRINT("error",("reclength: %d mean_rec_length: %d",
table->reclength, mean_rec_length));
- myrg_close(file);
- file=0;
- return my_errno=HA_ERR_WRONG_TABLE_DEF;
+ goto err;
}
+#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
+ /* Merge table has more than 2G rows */
+ if (table->crashed)
+ goto err;
+#endif
return (0);
+err:
+ myrg_close(file);
+ file=0;
+ return (my_errno= HA_ERR_WRONG_TABLE_DEF);
}
int ha_myisammrg::close(void)
@@ -184,8 +192,17 @@ void ha_myisammrg::info(uint flag)
{
MYMERGE_INFO info;
(void) myrg_status(file,&info,flag);
+ /*
+ The following fails if one has not compiled MySQL with -DBIG_TABLES
+ and one has more than 2^32 rows in the merge tables.
+ */
records = (ha_rows) info.records;
deleted = (ha_rows) info.deleted;
+#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
+ if ((info.records >= (ulonglong) 1 << 32) ||
+ (info.deleted >= (ulonglong) 1 << 32))
+ table->crashed=1;
+#endif
data_file_length=info.data_file_length;
errkey = info.errkey;
table->keys_in_use= set_bits(key_map, table->keys);
diff --git a/sql/handler.h b/sql/handler.h
index adbfff8c55c..fbc27f4729b 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -81,7 +81,7 @@
#define HA_READ_PREV 4 /* Read prev. record with same key */
#define HA_READ_ORDER 8 /* Read through record-keys in order */
#define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */
-#define HA_NOT_READ_PREFIX_LAST 32
+#define HA_NOT_READ_PREFIX_LAST 32 /* No support for index_read_last() */
#define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */
/*
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 10215f406c3..31197a0191e 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1127,6 +1127,8 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
used_tables_cache|=item->used_tables();
with_sum_func= with_sum_func || item->with_sum_func;
const_item_cache&=item->const_item();
+ if (item->maybe_null)
+ maybe_null=1;
}
if (thd)
thd->cond_count+=list.elements;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index d9c3f238af8..7e8213b4380 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -216,7 +216,7 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
if (!t_arg)
return result_field;
- switch (args[0]->result_type()) {
+ switch (result_type()) {
case INT_RESULT:
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,
@@ -2403,7 +2403,7 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name)
THD *thd=current_thd;
Item *item;
sys_var *var;
- char buff[MAX_SYS_VAR_LENGTH+3];
+ char buff[MAX_SYS_VAR_LENGTH+3+8], *pos;
if (!(var= find_sys_var(name.str, name.length)))
{
@@ -2415,8 +2415,14 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name)
thd->safe_to_cache_query=0;
buff[0]='@';
buff[1]='@';
- memcpy(buff+2, var->name, var->name_length+1);
- item->set_name(buff,var->name_length+2); // Will allocate name
+ pos=buff+2;
+ if (var_type == OPT_SESSION)
+ pos=strmov(pos,"session.");
+ else if (var_type == OPT_GLOBAL)
+ pos=strmov(pos,"global.");
+ memcpy(pos, var->name, var->name_length+1);
+ // set_name() will allocate the name
+ item->set_name(buff,(uint) (pos-buff)+var->name_length);
return item;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 0a0f2462f72..29eaf5a4ad9 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -114,7 +114,7 @@ String *Item_func_sha::val_str(String *str)
/* No need to check error as the only case would be too long message */
sha1_input(&context,(const unsigned char *) sptr->ptr(), sptr->length());
/* Ensure that memory is free and we got result */
- if ( !( str->alloc(SHA1_HASH_SIZE*2) || (sha1_result(&context,digest)) ) )
+ if (!( str->alloc(SHA1_HASH_SIZE*2) || (sha1_result(&context,digest))))
{
sprintf((char *) str->ptr(),
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\
@@ -144,24 +144,25 @@ void Item_func_sha::fix_length_and_dec()
String *Item_func_aes_encrypt::val_str(String *str)
{
- String * sptr = args[0]->val_str(str); // String to encrypt
- String tmp_value; // required to handle second parameter
- String * key= args[1]->val_str(&tmp_value); // key
+ char key_buff[80];
+ String tmp_key_value(key_buff, sizeof(key_buff));
+ String *sptr= args[0]->val_str(str); // String to encrypt
+ String *key= args[1]->val_str(&tmp_key_value); // key
int aes_length;
if (sptr && key) // we need both arguments to be not NULL
{
null_value=0;
- aes_length=my_aes_get_size(sptr->length()); // calculate result length
+ aes_length=my_aes_get_size(sptr->length()); // Calculate result length
- if (!str->alloc(aes_length)) // Ensure that memory is free
+ if (!str_value.alloc(aes_length)) // Ensure that memory is free
{
// finally encrypt directly to allocated buffer.
- if (my_aes_encrypt(sptr->ptr(),sptr->length(), (char*) str->ptr(),
+ if (my_aes_encrypt(sptr->ptr(),sptr->length(), (char*) str_value.ptr(),
key->ptr(), key->length()) == aes_length)
{
// We got the expected result length
- str->length((uint) aes_length);
- return str;
+ str_value.length((uint) aes_length);
+ return &str_value;
}
}
}
@@ -178,30 +179,35 @@ void Item_func_aes_encrypt::fix_length_and_dec()
String *Item_func_aes_decrypt::val_str(String *str)
{
- String * sptr= args[0]->val_str(str); // String to decrypt
- String tmp_value; // temporary string required for parsing
- String * key= args[1]->val_str(&tmp_value); // key
- int length; // original length after decrypt
- if (sptr && key) // Need to have both arguments not NULL
+ char key_buff[80];
+ String tmp_key_value(key_buff, sizeof(key_buff)), *sptr, *key;
+ DBUG_ENTER("Item_func_aes_decrypt::val_str");
+
+ sptr= args[0]->val_str(str); // String to decrypt
+ key= args[1]->val_str(&tmp_key_value); // Key
+ if (sptr && key) // Need to have both arguments not NULL
{
null_value=0;
- if (!str->alloc(sptr->length())) // Ensure that memory is free
+ if (!str_value.alloc(sptr->length())) // Ensure that memory is free
{
// finally decrypt directly to allocated buffer.
- length=my_aes_decrypt(sptr->ptr(), sptr->length(), (char*) str->ptr(),
+ int length;
+ length=my_aes_decrypt(sptr->ptr(), sptr->length(),
+ (char*) str_value.ptr(),
key->ptr(), key->length());
if (length >= 0) // if we got correct data data
{
- str->length((uint) length);
- return str;
+ str_value.length((uint) length);
+ DBUG_RETURN(&str_value);
}
}
}
// Bad parameters. No memory or bad data will all go here
null_value=1;
- return 0;
+ DBUG_RETURN(0);
}
+
void Item_func_aes_decrypt::fix_length_and_dec()
{
max_length=args[0]->max_length;
@@ -2325,7 +2331,7 @@ String *Item_func_quote::val_str(String *str)
0, \, ' and ^Z
*/
- static char escmask[32]=
+ static uchar escmask[32]=
{
0x01, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 28992a731fd..b98be7829fb 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -462,7 +462,11 @@ public:
Item_func_binary(Item *a) :Item_str_func(a) {}
const char *func_name() const { return "binary"; }
String *val_str(String *a)
- { a=args[0]->val_str(a); null_value=args[0]->null_value; return a; }
+ {
+ String *tmp=args[0]->val_str(a);
+ null_value=args[0]->null_value;
+ return tmp;
+ }
void fix_length_and_dec() { binary=1; max_length=args[0]->max_length; }
void print(String *str) { print_op(str); }
};
diff --git a/sql/lex.h b/sql/lex.h
index b9e993c54c7..6e36e01fbe7 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -257,6 +257,7 @@ static SYMBOL symbols[] = {
{ "NEW", SYM(NEW_SYM),0,0},
{ "NCHAR", SYM(NCHAR_SYM),0,0},
{ "NO", SYM(NO_SYM),0,0},
+ { "NONE", SYM(NONE_SYM),0,0},
{ "NOT", SYM(NOT),0,0},
{ "NULL", SYM(NULL_SYM),0,0},
{ "NUMERIC", SYM(NUMERIC_SYM),0,0},
diff --git a/sql/lock.cc b/sql/lock.cc
index 056ed0fec8f..aed0e1988ea 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -21,6 +21,46 @@
before getting internal locks. If we do it in the other order, the status
information is not up to date when called from the lock handler.
+ GENERAL DESCRIPTION OF LOCKING
+
+ When not using LOCK TABLES:
+
+ - For each SQL statement mysql_lock_tables() is called for all involved
+ tables.
+ - mysql_lock_tables() will call
+ table_handler->external_lock(thd,locktype) for each table.
+ This is followed by a call to thr_multi_lock() for all tables.
+
+ - When statement is done, we call mysql_unlock_tables().
+ This will call thr_multi_unlock() followed by
+ table_handler->external_lock(thd, F_UNLCK) for each table.
+
+ - Note that mysql_unlock_tables() may be called several times as
+ MySQL in some cases can free some tables earlier than others.
+
+ - The above is true both for normal and temporary tables.
+
+ - Temporary non transactional tables are never passed to thr_multi_lock()
+ and we never call external_lock(thd, F_UNLOCK) on these.
+
+ When using LOCK TABLES:
+
+ - LOCK TABLE will call mysql_lock_tables() for all tables.
+ mysql_lock_tables() will call
+ table_handler->external_lock(thd,locktype) for each table.
+ This is followed by a call to thr_multi_lock() for all tables.
+
+ - For each statement, we will call table_handler->start_stmt(THD)
+ to inform the table handler that we are using the table.
+
+ The tables used can only be tables used in LOCK TABLES or a
+ temporary table.
+
+ - When statement is done, we will call ha_commit_stmt(thd);
+
+ - When calling UNLOCK TABLES we call mysql_unlock_tables() for all
+ tables used in LOCK TABLES
+
TODO:
Change to use my_malloc() ONLY when using LOCK TABLES command or when
we are forced to use mysql_lock_merge.
@@ -206,7 +246,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
sql_lock->lock_count= found;
}
- /* Then to the same for the external locks */
+ /* Then do the same for the external locks */
/* Move all write locked tables first */
TABLE **table=sql_lock->table;
for (i=found=0 ; i < sql_lock->table_count ; i++)
@@ -430,7 +470,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
DBUG_ENTER("lock_table_name");
safe_mutex_assert_owner(&LOCK_open);
- key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->name)
+ key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->real_name)
-key)+ 1;
/* Only insert the table if we haven't insert it already */
@@ -459,7 +499,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
my_free((gptr) table,MYF(0));
DBUG_RETURN(-1);
}
- if (remove_table_from_cache(thd, table_list->db, table_list->name))
+ if (remove_table_from_cache(thd, table_list->db, table_list->real_name))
DBUG_RETURN(1); // Table is in use
DBUG_RETURN(0);
}
diff --git a/sql/log.cc b/sql/log.cc
index 213f5102507..59f99e3460e 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -108,11 +108,9 @@ MYSQL_LOG::~MYSQL_LOG()
int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
{
- if (log_type == LOG_NORMAL)
- fn_format(new_name,log_name,mysql_data_home,"",4);
- else
+ fn_format(new_name,log_name,mysql_data_home,"",4);
+ if (log_type != LOG_NORMAL)
{
- fn_format(new_name,log_name,mysql_data_home,"",4);
if (!fn_ext(log_name)[0])
{
if (find_uniq_filename(new_name))
@@ -394,12 +392,12 @@ err:
the NEXT log file name in the index file.
log_name Filename to find in the index file.
Is a null pointer if we want to read the first entry
- need_mutex Set this to 1 if the parent doesn't already have a
+ need_lock Set this to 1 if the parent doesn't already have a
lock on LOCK_index
NOTE
- On systems without the truncate function the file will end with one ore
- more empty lines
+ On systems without the truncate function the file will end with one or
+ more empty lines. These will be ignored when reading the file.
RETURN VALUES
0 ok
@@ -801,7 +799,8 @@ void MYSQL_LOG::new_file(bool need_lock)
safe_mutex_assert_owner(&LOCK_log);
safe_mutex_assert_owner(&LOCK_index);
- new_name_ptr= name; // Reuse old name if not binlog
+ // Reuse old name if not binlog and not update log
+ new_name_ptr= name;
/*
Only rotate open logs that are marked non-rotatable
@@ -809,12 +808,17 @@ void MYSQL_LOG::new_file(bool need_lock)
*/
if (!no_rotate)
{
+ /*
+ If user hasn't specified an extension, generate a new log name
+ We have to do this here and not in open as we want to store the
+ new file name in the current binary log file.
+ */
+ if (generate_new_name(new_name, name))
+ goto end;
+ new_name_ptr=new_name;
+
if (log_type == LOG_BIN)
{
- if (generate_new_name(new_name, name))
- goto end; /* Error; Continue using old log file */
-
- new_name_ptr=new_name;
if (!no_auto_events)
{
/*
@@ -826,9 +830,9 @@ void MYSQL_LOG::new_file(bool need_lock)
r.set_log_pos(this);
/*
- Becasue this log rotation could have been initiated by a master of
+ Because this log rotation could have been initiated by a master of
the slave running with log-bin, we set the flag on rotate
- event to prevent inifinite log rotation loop
+ event to prevent infinite log rotation loop
*/
if (thd->slave_thread)
r.flags|= LOG_EVENT_FORCED_ROTATE_F;
@@ -836,7 +840,7 @@ void MYSQL_LOG::new_file(bool need_lock)
bytes_written += r.get_event_len();
}
/*
- Update needs to be signaled even if there is no rotate event
+ Update needs to be signalled even if there is no rotate event
log rotation should give the waiting thread a signal to
discover EOF and move on to the next log.
*/
@@ -1328,6 +1332,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
end=strxmov(buff, "# administrator command: ",
command_name[thd->command], NullS);
query_length=(ulong) (end-buff);
+ query=buff;
}
if (my_b_write(&log_file, (byte*) query,query_length) ||
my_b_write(&log_file, (byte*) ";\n",2) ||
@@ -1386,6 +1391,7 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
This can be set to 0 if we are going to do call open
at once after close, in which case we don't want to
close the index file.
+ We only write a 'stop' event to the log if exiting is set
*/
void MYSQL_LOG::close(bool exiting)
@@ -1394,7 +1400,7 @@ void MYSQL_LOG::close(bool exiting)
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
if (is_open())
{
- if (log_type == LOG_BIN && !no_auto_events)
+ if (log_type == LOG_BIN && !no_auto_events && exiting)
{
Stop_log_event s;
s.set_log_pos(this);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index df5ef4eb7fe..70fc1a5ff23 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -100,7 +100,7 @@ static void pretty_print_str(String* packet, char* str, int len)
static inline char* slave_load_file_stem(char*buf, uint file_id,
int event_server_id)
{
- fn_format(buf,"SQL_LOAD-",slave_load_tmpdir,"",4+32);
+ fn_format(buf,"SQL_LOAD-",slave_load_tmpdir,"",0); /* 4+32); */
buf = strend(buf);
buf = int10_to_str(::server_id, buf, 10);
*buf++ = '-';
@@ -690,7 +690,10 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
if (new_log_ident)
my_fwrite(file, (byte*) new_log_ident, (uint)ident_len,
MYF(MY_NABP | MY_WME));
- fprintf(file, " pos: %s\n", llstr(pos, buf));
+ fprintf(file, " pos: %s", llstr(pos, buf));
+ if (flags & LOG_EVENT_FORCED_ROTATE_F)
+ fprintf(file," forced by master");
+ fputc('\n', file);
fflush(file);
}
@@ -730,20 +733,22 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
buf += header_size;
if (old_format)
{
- ident_len = (uchar)(event_len - OLD_HEADER_LEN);
+ ident_len = (uint)(event_len - OLD_HEADER_LEN);
pos = 4;
ident_offset = 0;
}
else
{
- ident_len = (uchar)(event_len - ROTATE_EVENT_OVERHEAD);
+ ident_len = (uint)(event_len - ROTATE_EVENT_OVERHEAD);
pos = uint8korr(buf + R_POS_OFFSET);
ident_offset = ROTATE_HEADER_LEN;
}
- if (!(new_log_ident = (char*) my_memdup((byte*) buf + ident_offset,
- (uint) ident_len, MYF(MY_WME))))
+ set_if_smaller(ident_len,FN_REFLEN-1);
+ if (!(new_log_ident= my_strdup_with_length((byte*) buf +
+ ident_offset,
+ (uint) ident_len,
+ MYF(MY_WME))))
return;
-
alloced = 1;
}
@@ -1623,7 +1628,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
int expected_error,actual_error = 0;
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)db);
- DBUG_ASSERT(q_len == strlen(query));
/*
InnoDB internally stores the master log position it has processed so far;
@@ -1652,6 +1656,8 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (ignored_error_code((expected_error = error_code)) ||
!check_expected_error(thd,rli,expected_error))
{
+ mysql_log.write(thd,COM_QUERY,"%s",thd->query);
+ DBUG_PRINT("query",("%s",thd->query));
mysql_parse(thd, thd->query, q_len);
if ((expected_error != (actual_error = thd->net.last_errno)) &&
expected_error &&
@@ -1721,7 +1727,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
TABLE_LIST tables;
bzero((char*) &tables,sizeof(tables));
tables.db = thd->db;
- tables.name = tables.real_name = (char*)table_name;
+ tables.alias = tables.real_name = (char*)table_name;
tables.lock_type = TL_WRITE;
// the table will be opened in mysql_load
if (table_rules_on && !tables_ok(thd, &tables))
@@ -1874,71 +1880,34 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli)
Got a rotate log even from the master
IMPLEMENTATION
- - Rotate the log file if the name of the log file changed
- (In practice this should always be the case)
+ This is mainly used so that we can later figure out the logname and
+ position for the master.
- TODO
- - Investigate/Test if we can't ignore all rotate log events
- that we get from the master (and not even write it to the local
- binary log).
+ We can't rotate the slave as this will cause infinitive rotations
+ in a A -> B -> A setup.
RETURN VALUES
- 0 ok
- 1 Impossible new log file name (rotate log event is ignored)
-*/
+ 0 ok
+ */
int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
{
- bool rotate_binlog = 0, write_slave_event = 0;
char* log_name = rli->master_log_name;
DBUG_ENTER("Rotate_log_event::exec_event");
pthread_mutex_lock(&rli->data_lock);
- /*
- TODO: probably needs re-write
- rotate local binlog only if the name of remote has changed
- */
- if (!*log_name || (memcmp(log_name, new_log_ident, ident_len) ||
- log_name[ident_len] != 0))
- {
- write_slave_event = (!(flags & LOG_EVENT_FORCED_ROTATE_F) &&
- mysql_bin_log.is_open());
- rotate_binlog = (*log_name && write_slave_event);
- if (ident_len >= sizeof(rli->master_log_name))
- {
- // This should be impossible
- pthread_mutex_unlock(&rli->data_lock);
- DBUG_RETURN(1);
- }
- memcpy(log_name, new_log_ident, ident_len);
- log_name[ident_len] = 0;
- }
+ memcpy(log_name, new_log_ident, ident_len+1);
rli->master_log_pos = pos;
rli->relay_log_pos += get_event_len();
- if (rotate_binlog)
- {
- mysql_bin_log.new_file();
- rli->master_log_pos = BIN_LOG_HEADER_SIZE;
- }
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) rli->master_log_pos));
- pthread_cond_broadcast(&rli->data_cond);
pthread_mutex_unlock(&rli->data_lock);
+ pthread_cond_broadcast(&rli->data_cond);
flush_relay_log_info(rli);
-
- if (write_slave_event)
- {
- Slave_log_event s(thd, rli);
- if (s.master_host)
- {
- s.set_log_pos(&mysql_bin_log);
- s.server_id = ::server_id;
- mysql_bin_log.write(&s);
- }
- }
DBUG_RETURN(0);
}
+
int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
{
switch (type) {
diff --git a/sql/log_event.h b/sql/log_event.h
index b69643c366a..5f7aa4ad586 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -522,16 +522,15 @@ class Rotate_log_event: public Log_event
{
public:
const char* new_log_ident;
- uchar ident_len;
ulonglong pos;
+ uint ident_len;
bool alloced;
#ifndef MYSQL_CLIENT
Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
uint ident_len_arg = 0,ulonglong pos_arg = 4)
: Log_event(thd_arg), new_log_ident(new_log_ident_arg),
- ident_len(ident_len_arg ? ident_len_arg :
- (uint) strlen(new_log_ident_arg)), pos(pos_arg),
- alloced(0)
+ pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
+ (uint) strlen(new_log_ident_arg)), alloced(0)
{}
void pack_info(String* packet);
int exec_event(struct st_relay_log_info* rli);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 4532646b1c2..49e7c8d9734 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -317,6 +317,7 @@ bool mysql_new_select(LEX *lex, bool move_down);
void create_select_for_variable(const char *var_name);
void mysql_init_multi_delete(LEX *lex);
void init_max_user_conn(void);
+void init_update_queries(void);
void free_max_user_conn(void);
pthread_handler_decl(handle_one_connection,arg);
pthread_handler_decl(handle_bootstrap,arg);
@@ -559,6 +560,7 @@ bool rm_temporary_table(enum db_type base, char *path);
bool send_fields(THD *thd,List<Item> &item,uint send_field_count);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
+bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_thread_tables(THD *thd,bool locked=0);
bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_temporary_tables(THD *thd);
@@ -714,11 +716,14 @@ extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db;
extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb;
-
#ifndef __WIN__
extern pthread_t signal_thread;
#endif
+#ifdef HAVE_OPENSSL
+extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
+#endif /* HAVE_OPENSSL */
+
MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **table,uint count);
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 8c3db86e44f..900d529827e 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -379,15 +379,14 @@ char mysql_real_data_home[FN_REFLEN],
blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
*opt_init_file;
char *language_ptr= language;
+char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
#ifndef EMBEDDED_LIBRARY
-char mysql_data_home_buff[2], *mysql_data_home=mysql_data_home_buff;
bool mysql_embedded=0;
#else
-char *mysql_data_home=mysql_real_data_home;
bool mysql_embedded=1;
#endif
-char *opt_bin_logname = 0; // this one needs to be seen in sql_parse.cc
+static char *opt_bin_logname = 0;
char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION;
const char *first_keyword="first";
@@ -398,6 +397,7 @@ ulong rpl_recovery_rank=0;
my_string mysql_unix_port=NULL, opt_mysql_tmpdir=NULL, mysql_tmpdir=NULL;
ulong my_bind_addr; /* the address we bind to */
+char *my_bind_addr_str;
DATE_FORMAT dayord;
double log_10[32]; /* 10 potences */
I_List<THD> threads,thread_cache;
@@ -1747,10 +1747,10 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
first change fn_format() to cut the file name if it's too long.
*/
strmake(tmp,hostname,FN_REFLEN-5);
- strmov(strcend(tmp,'.'),extension);
+ strmov(fn_ext(tmp),extension);
opt_name=tmp;
}
- // get rid of extention if the log is binary to avoid problems
+ // get rid of extension if the log is binary to avoid problems
if (type == LOG_BIN)
{
char *p = fn_ext(opt_name);
@@ -1817,7 +1817,7 @@ int main(int argc, char **argv)
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
strmov(glob_hostname,"mysql");
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
- strmov(strcend(pidfile_name,'.'),".pid"); // Add extension
+ strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
#ifndef DBUG_OFF
strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS);
#else
@@ -1886,9 +1886,6 @@ int main(int argc, char **argv)
charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
#ifdef HAVE_OPENSSL
- if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
- opt_ssl_cipher)
- opt_use_ssl= 1;
if (opt_use_ssl)
{
/* having ssl_acceptor_fd != 0 signals the use of SSL */
@@ -1961,6 +1958,7 @@ int main(int argc, char **argv)
{
unireg_abort(1); /* purecov: inspected */
}
+ mysql_data_home= mysql_data_home_buff;
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0;
server_init();
@@ -2050,6 +2048,7 @@ int main(int argc, char **argv)
if (!opt_noacl)
(void) grant_init();
init_max_user_conn();
+ init_update_queries();
#ifdef HAVE_DLOPEN
if (!opt_noacl)
@@ -2079,16 +2078,6 @@ The server will not act as a slave.");
}
if (opt_bin_log)
{
- if (!opt_bin_logname)
- {
- char tmp[FN_REFLEN];
- /* TODO: The following should be using fn_format(); We just need to
- first change fn_format() to cut the file name if it's too long.
- */
- strmake(tmp,glob_hostname,FN_REFLEN-5);
- strmov(strcend(tmp,'.'),"-bin");
- opt_bin_logname=my_strdup(tmp,MYF(MY_WME));
- }
open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
opt_binlog_index_name,LOG_BIN);
using_update_log=1;
@@ -2751,7 +2740,7 @@ pthread_handler_decl(handle_connections_namedpipes,arg)
PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
(int) global_system_variables.net_buffer_length,
- (int) global_systenm_ariables.net_buffer_length,
+ (int) global_system_variables.net_buffer_length,
NMPWAIT_USE_DEFAULT_WAIT,
&saPipeSecurity )) ==
INVALID_HANDLE_VALUE )
@@ -2960,9 +2949,9 @@ struct my_option my_long_options[] =
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
"Tells the master that updates to the given database should not be logged tothe binary log",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"bind-address", OPT_BIND_ADDRESS, "Ip address to bind to",
- (gptr*) &my_bind_addr, (gptr*) &my_bind_addr, 0, GET_STR, REQUIRED_ARG, 0,
- 0, 0, 0, 0, 0},
+ {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to",
+ (gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
@@ -3003,14 +2992,14 @@ struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-table-type", OPT_TABLE_TYPE,
"Set the default table type for tables", 0, 0,
- 0, GET_NO_ARG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE",
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL,
- "Don't flush key buffers between writes for any MyISAM table (Depricated option, use --delay-key-write=all instead)",
+ "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"enable-locking", OPT_ENABLE_LOCK,
- "Depricated option, use --external-locking instead",
+ "Deprecated option, use --external-locking instead",
(gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
@@ -3048,10 +3037,10 @@ struct my_option my_long_options[] =
"Set to 1 if you want to have logs archived", 0, 0, 0, GET_LONG, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
- "Set to 0 if you don't want to flush logs",
+ "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second)",
(gptr*) &innobase_flush_log_at_trx_commit,
(gptr*) &innobase_flush_log_at_trx_commit,
- 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ 0, GET_UINT, OPT_ARG, 0, 0, 2, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data", (gptr*) &innobase_unix_file_flush_method,
(gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
@@ -3247,7 +3236,7 @@ struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB,
- "Depricated option; One should use GRANT SHOW DATABASES instead...",
+ "Deprecated option; One should use GRANT SHOW DATABASES instead...",
(gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
@@ -3277,7 +3266,7 @@ struct my_option my_long_options[] =
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK,
- "Depricated option, use --skip-external-locking instead",
+ "Deprecated option, use --skip-external-locking instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -3342,7 +3331,7 @@ struct my_option my_long_options[] =
#ifdef USE_SYMDIR
{"use-symbolic-links", 's', "Enable symbolic link support",
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
- USE_PURIFY(0,1), 0, 0, 0, 0, 0},
+ IF_PURIFY(0,1), 0, 0, 0, 0, 0},
#endif
{"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user,
(gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -3406,7 +3395,7 @@ struct my_option my_long_options[] =
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
- REQUIRED_ARG, 4, 2, HA_FT_MAXLEN, 0, 1, 0},
+ REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
"The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,
@@ -3488,7 +3477,7 @@ struct my_option my_long_options[] =
"Max packetlength to send/receive from to server.",
(gptr*) &global_system_variables.max_allowed_packet,
(gptr*) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
- REQUIRED_ARG, 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
+ REQUIRED_ARG, 1024*1024L, 80, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
"Can be used to restrict the total size used to cache a multi-transaction query.",
(gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0,
@@ -3760,7 +3749,7 @@ struct show_var_st status_vars[]= {
{"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG},
{"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG},
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG},
- {"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG},
+ {"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_CONST},
{"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG},
{"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG},
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_CONST},
@@ -3990,6 +3979,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
net_buffer_length= atoi(argument);
break;
#endif
+#include <sslopt-case.h>
case 'v':
case 'V':
print_version();
diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc
index 19234181839..b804724564e 100644
--- a/sql/net_pkg.cc
+++ b/sql/net_pkg.cc
@@ -140,7 +140,13 @@ net_printf(THD *thd, uint errcode, ...)
is useful for rare errors that are not worth the hassle to put in
errmsg.sys, but at the same time, the message is not fixed text
*/
- format=errcode ? ER(errcode) : va_arg(args,char*);
+ if (errcode)
+ format= ER(errcode);
+ else
+ {
+ format=va_arg(args,char*);
+ errcode= ER_UNKNOWN_ERROR;
+ }
offset= net->return_errno ? 2 : 0;
text_pos=(char*) net->buff+head_length+offset+1;
(void) vsprintf(my_const_cast(char*) (text_pos),format,args);
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 538ff5babe6..51910167d97 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -237,6 +237,7 @@ my_net_write(NET *net,const char *packet,ulong len)
buff[3]= (uchar) net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
return 1;
+ DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE);
return net_write_buff(net,packet,len);
}
@@ -639,6 +640,7 @@ my_real_read(NET *net, ulong *complen)
("Packets out of order (Found: %d, expected %u)",
(int) net->buff[net->where_b + 3],
net->pkt_nr));
+ DBUG_DUMP("packet_header",(char*) net->buff+net->where_b, 4);
#ifdef EXTRA_DEBUG
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3],
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index e10aff40386..ed5b2b0a230 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2705,13 +2705,19 @@ int QUICK_SELECT_DESC::get_next()
}
else
{
+ /* Heikki changed Sept 11, 2002: since InnoDB does not store the cursor
+ position if READ_KEY_EXACT is used to a primary key with all
+ key columns specified, we must use below HA_READ_KEY_OR_NEXT,
+ so that InnoDB stores the cursor position and is able to move
+ the cursor one step backward after the search. */
+
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
/* Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
* do the right thing - go past all keys which match the prefix */
result=file->index_read(record, (byte*) range->max_key,
range->max_length,
((range->flag & NEAR_MAX) ?
- HA_READ_KEY_EXACT : HA_READ_AFTER_KEY));
+ HA_READ_KEY_OR_NEXT : HA_READ_AFTER_KEY));
result = file->index_prev(record);
}
if (result)
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 3d4a7893790..4295a16c547 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -75,8 +75,6 @@ static int init_failsafe_rpl_thread(THD* thd)
DBUG_RETURN(-1);
}
- thd->mysys_var=my_thread_var;
- thd->dbug_thread_id=my_thread_id();
#if !defined(__WIN__) && !defined(OS2)
sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use
@@ -238,7 +236,7 @@ static int find_target_pos(LEX_MASTER_INFO *mi, IO_CACHE *log, char *errmsg)
return 1;
}
- if (ev->log_pos == log_pos && ev->server_id == target_server_id)
+ if (ev->log_pos >= log_pos && ev->server_id == target_server_id)
{
delete ev;
mi->pos = my_b_tell(log);
@@ -263,23 +261,24 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
int error = 1;
int cmp_res;
LINT_INIT(cmp_res);
+ DBUG_ENTER("translate_master");
if (!mysql_bin_log.is_open())
{
strmov(errmsg,"Binary log is not open");
- return 1;
+ DBUG_RETURN(1);
}
if (!server_id_supplied)
{
strmov(errmsg, "Misconfigured master - server id was not set");
- return 1;
+ DBUG_RETURN(1);
}
if (mysql_bin_log.find_log_pos(&linfo, NullS, 1))
{
strmov(errmsg,"Could not find first log");
- return 1;
+ DBUG_RETURN(1);
}
thd->current_linfo = &linfo;
@@ -368,7 +367,7 @@ err:
if (last_file >= 0 && last_file != file)
(void) my_close(last_file, MYF(MY_WME));
- return error;
+ DBUG_RETURN(error);
}
@@ -425,12 +424,9 @@ int show_new_master(THD* thd)
if (translate_master(thd, lex_mi, errmsg))
{
if (errmsg[0])
- net_printf(thd, ER_ERROR_WHEN_EXECUTING_COMMAND,
- "SHOW NEW MASTER", errmsg);
- else
- send_error(thd, 0);
-
- DBUG_RETURN(1);
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
+ "SHOW NEW MASTER", errmsg);
+ DBUG_RETURN(-1);
}
else
{
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 29c9ac09131..b221a3f98ff 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -472,7 +472,7 @@ struct show_var_st init_vars[]= {
{"log", (char*) &opt_log, SHOW_BOOL},
{"log_update", (char*) &opt_update_log, SHOW_BOOL},
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
- {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_BOOL},
+ {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
{"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL},
{sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS},
{sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS},
@@ -501,7 +501,7 @@ struct show_var_st init_vars[]= {
{"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR},
{sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS},
#ifdef __NT__
- {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_BOOL},
+ {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
#endif
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
{sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
@@ -920,7 +920,7 @@ byte *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type)
bool sys_var_thd_bit::update(THD *thd, set_var *var)
{
- bool res= (*update_func)(thd, var);
+ int res= (*update_func)(thd, var);
thd->lex.select_lex.options=thd->options;
return res;
}
@@ -1034,7 +1034,7 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type)
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
{
- bool result=0;
+ int result= 0;
LOCK_ACTIVE_MI;
pthread_mutex_lock(&active_mi->rli.run_lock);
if (active_mi->rli.slave_running)
@@ -1248,7 +1248,8 @@ void set_var_free()
sys_var *find_sys_var(const char *str, uint length)
{
- sys_var *var= (sys_var*) hash_search(&system_variable_hash, str,
+ sys_var *var= (sys_var*) hash_search(&system_variable_hash,
+ (byte*) str,
length ? length :
strlen(str));
if (!var)
@@ -1275,26 +1276,24 @@ sys_var *find_sys_var(const char *str, uint length)
RETURN VALUE
0 ok
- 1 Something got wrong (normally no variables was updated)
+ 1 ERROR, message sent (normally no variables was updated)
+ -1 ERROR, message not sent
*/
-bool sql_set_variables(THD *thd, List<set_var_base> *var_list)
+int sql_set_variables(THD *thd, List<set_var_base> *var_list)
{
- bool error=0;
+ int error= 0;
List_iterator<set_var_base> it(*var_list);
set_var_base *var;
while ((var=it++))
{
- if (var->check(thd))
- return 1;
+ if ((error=var->check(thd)))
+ return error;
}
it.rewind();
while ((var=it++))
- {
- if (var->update(thd))
- error=1;
- }
+ error|= var->update(thd); // Returns 0, -1 or 1
return error;
}
@@ -1303,14 +1302,14 @@ bool sql_set_variables(THD *thd, List<set_var_base> *var_list)
Functions to handle SET mysql_internal_variable=const_expr
*****************************************************************************/
-bool set_var::check(THD *thd)
+int set_var::check(THD *thd)
{
if (var->check_type(type))
{
my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE,
MYF(0),
var->name);
- return 1;
+ return -1;
}
if ((type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)))
return 1;
@@ -1321,28 +1320,28 @@ bool set_var::check(THD *thd)
if (var->check_default(type))
{
my_error(ER_NO_DEFAULT, MYF(0), var->name);
- return 1;
+ return -1;
}
return 0;
}
if (value->fix_fields(thd, 0, &value))
- return 1;
+ return -1;
if (var->check_update_type(value->result_type()))
{
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name);
- return 1;
+ return -1;
}
- return var->check(thd, this);
+ return var->check(thd, this) ? -1 : 0;
}
-bool set_var::update(THD *thd)
+int set_var::update(THD *thd)
{
if (!value)
var->set_default(thd, type);
else if (var->update(thd, this))
- return 1; // should never happen
+ return -1; // should never happen
if (var->after_update)
(*var->after_update)(thd, type);
return 0;
@@ -1353,19 +1352,19 @@ bool set_var::update(THD *thd)
Functions to handle SET @user_variable=const_expr
*****************************************************************************/
-bool set_var_user::check(THD *thd)
+int set_var_user::check(THD *thd)
{
- return user_var_item->fix_fields(thd,0, (Item**) 0);
+ return user_var_item->fix_fields(thd,0, (Item**) 0) ? -1 : 0;
}
-bool set_var_user::update(THD *thd)
+int set_var_user::update(THD *thd)
{
if (user_var_item->update())
{
/* Give an error if it's not given already */
- send_error(thd, ER_SET_CONSTANTS_ONLY);
- return 1;
+ my_error(ER_SET_CONSTANTS_ONLY, MYF(0));
+ return -1;
}
return 0;
}
@@ -1375,16 +1374,19 @@ bool set_var_user::update(THD *thd)
Functions to handle SET PASSWORD
*****************************************************************************/
-bool set_var_password::check(THD *thd)
+int set_var_password::check(THD *thd)
{
if (!user->host.str)
user->host.str= (char*) thd->host_or_ip;
- return check_change_password(thd, user->host.str, user->user.str);
+ /* Returns 1 as the function sends error to client */
+ return check_change_password(thd, user->host.str, user->user.str) ? 1 : 0;
}
-bool set_var_password::update(THD *thd)
+int set_var_password::update(THD *thd)
{
- return change_password(thd, user->host.str, user->user.str, password);
+ /* Returns 1 as the function sends error to client */
+ return (change_password(thd, user->host.str, user->user.str, password) ?
+ 1 : 0);
}
/****************************************************************************
diff --git a/sql/set_var.h b/sql/set_var.h
index 2c40414f591..31154d1e1d7 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -385,8 +385,8 @@ class set_var_base :public Sql_alloc
public:
set_var_base() {}
virtual ~set_var_base() {}
- virtual bool check(THD *thd)=0; /* To check privileges etc. */
- virtual bool update(THD *thd)=0; /* To set the value */
+ virtual int check(THD *thd)=0; /* To check privileges etc. */
+ virtual int update(THD *thd)=0; /* To set the value */
};
@@ -421,8 +421,8 @@ public:
else
value=value_arg;
}
- bool check(THD *thd);
- bool update(THD *thd);
+ int check(THD *thd);
+ int update(THD *thd);
};
@@ -435,8 +435,8 @@ public:
set_var_user(Item_func_set_user_var *item)
:user_var_item(item)
{}
- bool check(THD *thd);
- bool update(THD *thd);
+ int check(THD *thd);
+ int update(THD *thd);
};
/* For SET PASSWORD */
@@ -449,8 +449,8 @@ public:
set_var_password(LEX_USER *user_arg,char *password_arg)
:user(user_arg), password(password_arg)
{}
- bool check(THD *thd);
- bool update(THD *thd);
+ int check(THD *thd);
+ int update(THD *thd);
};
@@ -461,7 +461,7 @@ public:
void set_var_init();
void set_var_free();
sys_var *find_sys_var(const char *str, uint length=0);
-bool sql_set_variables(THD *thd, List<set_var_base> *var_list);
+int sql_set_variables(THD *thd, List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);
extern sys_var_str sys_charset;
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 55a89124d0a..a0c11fe7fb3 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -150,7 +150,7 @@
"Table '%-.64s.%-.64s' doesn't exist",
"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'",
"The used command is not allowed with this MySQL version",
-"You have an error in your SQL syntax",
+"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use",
"Delayed insert thread couldn't get requested lock for table %-.64s",
"Too many delayed threads in use",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)",
diff --git a/sql/slave.cc b/sql/slave.cc
index 71dbb1fc1a2..0f241cd759d 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -922,7 +922,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
bzero((char*) &tables,sizeof(tables));
tables.db = (char*)db;
- tables.name = tables.real_name = (char*)table_name;
+ tables.alias= tables.real_name= (char*)table_name;
tables.lock_type = TL_WRITE;
thd->proc_info = "Opening master dump table";
if (!open_ltable(thd, &tables, TL_WRITE))
@@ -1479,6 +1479,8 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
int event_count = 0;
ulong init_abort_pos_wait;
DBUG_ENTER("wait_for_pos");
+ DBUG_PRINT("enter",("master_log_name: '%s' pos: %ld",
+ master_log_name, (ulong) master_log_pos));
pthread_mutex_lock(&data_lock);
// abort only if master info changes during wait
@@ -1509,6 +1511,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
if (pos_reached || thd->killed)
break;
+ DBUG_PRINT("info",("Waiting for master update"));
const char* msg = thd->enter_cond(&data_cond, &data_lock,
"Waiting for master update");
pthread_cond_wait(&data_cond, &data_lock);
@@ -1550,8 +1553,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
DBUG_RETURN(-1);
}
- thd->mysys_var=my_thread_var;
- thd->dbug_thread_id=my_thread_id();
#if !defined(__WIN__) && !defined(OS2)
sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use
@@ -2320,21 +2321,44 @@ err:
}
/*
- We assume we already locked mi->data_lock
+ Start using a new binary log on the master
+
+ SYNOPSIS
+ process_io_rotate()
+ mi master_info for the slave
+ rev The rotate log event read from the binary log
+
+ DESCRIPTION
+ Updates the master info and relay data with the place in the next binary
+ log where we should start reading.
+
+ NOTES
+ We assume we already locked mi->data_lock
+
+ RETURN VALUES
+ 0 ok
+ 1 Log event is illegal
*/
-static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
+static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev)
{
+ int return_val= 1;
DBUG_ENTER("process_io_rotate");
+ safe_mutex_assert_owner(&mi->data_lock);
if (unlikely(!rev->is_valid()))
DBUG_RETURN(1);
- DBUG_ASSERT(rev->ident_len < sizeof(mi->master_log_name));
- memcpy(mi->master_log_name,rev->new_log_ident,
- rev->ident_len);
- mi->master_log_name[rev->ident_len] = 0;
- mi->master_log_pos = rev->pos;
- DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
+
+ memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1);
+ mi->master_log_pos= rev->pos;
+
+ pthread_mutex_lock(&mi->rli.data_lock);
+ memcpy(mi->rli.master_log_name, rev->new_log_ident, rev->ident_len+1);
+ mi->rli.master_log_pos= rev->pos;
+ pthread_mutex_unlock(&mi->rli.data_lock);
+
+ DBUG_PRINT("info", ("master_log_pos: '%s' %d",
+ mi->master_log_name, (ulong) mi->master_log_pos));
#ifndef DBUG_OFF
/*
If we do not do this, we will be getting the first
@@ -2347,23 +2371,24 @@ static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
}
/*
- TODO: verify the issue with stop events, see if we need them at all
- in the relay log
- TODO: test this code before release - it has to be tested on a separte
- setup with 3.23 master
+ TODO:
+ Test this code before release - it has to be tested on a separate
+ setup with 3.23 master
*/
static int queue_old_event(MASTER_INFO *mi, const char *buf,
ulong event_len)
{
const char *errmsg = 0;
- bool inc_pos = 1;
- bool processed_stop_event = 0;
- char* tmp_buf = 0;
+ ulong inc_pos;
+ bool ignore_event= 0;
+ char *tmp_buf = 0;
+ RELAY_LOG_INFO *rli= &mi->rli;
DBUG_ENTER("queue_old_event");
- /* if we get Load event, we need to pass a non-reusable buffer
- to read_log_event, so we do a trick
+ /*
+ If we get Load event, we need to pass a non-reusable buffer
+ to read_log_event, so we do a trick
*/
if (buf[EVENT_TYPE_OFFSET] == LOAD_EVENT)
{
@@ -2389,54 +2414,52 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
pthread_mutex_lock(&mi->data_lock);
ev->log_pos = mi->master_log_pos;
switch (ev->get_type_code()) {
+ case STOP_EVENT:
+ ignore_event= mi->ignore_stop_event;
+ mi->ignore_stop_event=0;
+ inc_pos= event_len;
+ break;
case ROTATE_EVENT:
if (unlikely(process_io_rotate(mi,(Rotate_log_event*)ev)))
{
delete ev;
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(!tmp_buf);
DBUG_RETURN(1);
}
mi->ignore_stop_event=1;
- inc_pos = 0;
- break;
- case STOP_EVENT:
- processed_stop_event=1;
+ inc_pos= 0;
break;
case CREATE_FILE_EVENT:
{
+ /* We come here when and only when tmp_buf != 0 */
+ DBUG_ASSERT(tmp_buf);
int error = process_io_create_file(mi,(Create_file_log_event*)ev);
delete ev;
mi->master_log_pos += event_len;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(tmp_buf);
my_free((char*)tmp_buf, MYF(0));
DBUG_RETURN(error);
}
default:
mi->ignore_stop_event=0;
+ inc_pos= event_len;
break;
}
- if (likely(!processed_stop_event || !mi->ignore_stop_event))
+ if (likely(!ignore_event))
{
- if (unlikely(mi->rli.relay_log.append(ev)))
+ if (unlikely(rli->relay_log.append(ev)))
{
delete ev;
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(!tmp_buf);
DBUG_RETURN(1);
}
- mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
+ rli->relay_log.harvest_bytes_written(&rli->log_space_total);
}
delete ev;
- if (likely(inc_pos))
- mi->master_log_pos += event_len;
+ mi->master_log_pos+= inc_pos;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
- if (unlikely(processed_stop_event))
- mi->ignore_stop_event=1;
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(!tmp_buf);
DBUG_RETURN(0);
}
@@ -2447,48 +2470,52 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
{
- int error=0;
- bool inc_pos = 1;
- bool processed_stop_event = 0;
+ int error= 0;
+ ulong inc_pos;
+ bool ignore_event= 0;
+ RELAY_LOG_INFO *rli= &mi->rli;
DBUG_ENTER("queue_event");
if (mi->old_format)
DBUG_RETURN(queue_old_event(mi,buf,event_len));
pthread_mutex_lock(&mi->data_lock);
-
+
/*
TODO: figure out if other events in addition to Rotate
require special processing
*/
switch (buf[EVENT_TYPE_OFFSET]) {
case STOP_EVENT:
- processed_stop_event=1;
+ ignore_event= mi->ignore_stop_event;
+ mi->ignore_stop_event= 0;
+ inc_pos= event_len;
break;
case ROTATE_EVENT:
{
Rotate_log_event rev(buf,event_len,0);
if (unlikely(process_io_rotate(mi,&rev)))
+ {
+ pthread_mutex_unlock(&mi->data_lock);
DBUG_RETURN(1);
- inc_pos=0;
- mi->ignore_stop_event=1;
+ }
+ mi->ignore_stop_event= 1;
+ inc_pos= 0;
break;
}
default:
- mi->ignore_stop_event=0;
+ mi->ignore_stop_event= 0;
+ inc_pos= event_len;
break;
}
- if (likely((!processed_stop_event || !mi->ignore_stop_event) &&
- !(error = mi->rli.relay_log.appendv(buf,event_len,0))))
+ if (likely(!ignore_event &&
+ !(error= rli->relay_log.appendv(buf,event_len,0))))
{
- if (likely(inc_pos))
- mi->master_log_pos += event_len;
+ mi->master_log_pos+= inc_pos;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
- mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
+ rli->relay_log.harvest_bytes_written(&rli->log_space_total);
}
- if (unlikely(processed_stop_event))
- mi->ignore_stop_event=1;
pthread_mutex_unlock(&mi->data_lock);
DBUG_RETURN(error);
}
@@ -2706,7 +2733,6 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
pthread_mutex_t *log_lock = rli->relay_log.get_log_lock();
const char* errmsg=0;
THD* thd = rli->sql_thd;
- bool was_killed;
DBUG_ENTER("next_event");
DBUG_ASSERT(thd != 0);
diff --git a/sql/slave.h b/sql/slave.h
index b527aceb432..cbcd2957476 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -312,6 +312,7 @@ typedef struct st_master_info
} MASTER_INFO;
+
int queue_event(MASTER_INFO* mi,const char* buf,ulong event_len);
typedef struct st_table_rule_ent
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e6b9a1f532b..aab3e8899ce 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -64,10 +64,8 @@ public:
USER_RESOURCES user_resource;
char *user,*password;
ulong salt[2];
-#ifdef HAVE_OPENSSL
enum SSL_type ssl_type;
const char *ssl_cipher, *x509_issuer, *x509_subject;
-#endif /* HAVE_OPENSSL */
};
@@ -116,38 +114,27 @@ static void update_hostname(acl_host_and_ip *host, const char *hostname);
static bool compare_hostname(const acl_host_and_ip *host, const char *hostname,
const char *ip);
-extern char uc_update_queries[SQLCOM_END];
+/*
+ Read grant privileges from the privilege tables in the 'mysql' database.
-static void init_update_queries(void)
-{
- uc_update_queries[SQLCOM_CREATE_TABLE]=1;
- uc_update_queries[SQLCOM_CREATE_INDEX]=1;
- uc_update_queries[SQLCOM_ALTER_TABLE]=1;
- uc_update_queries[SQLCOM_UPDATE]=1;
- uc_update_queries[SQLCOM_INSERT]=1;
- uc_update_queries[SQLCOM_INSERT_SELECT]=1;
- uc_update_queries[SQLCOM_DELETE]=1;
- uc_update_queries[SQLCOM_TRUNCATE]=1;
- uc_update_queries[SQLCOM_DROP_TABLE]=1;
- uc_update_queries[SQLCOM_LOAD]=1;
- uc_update_queries[SQLCOM_CREATE_DB]=1;
- uc_update_queries[SQLCOM_DROP_DB]=1;
- uc_update_queries[SQLCOM_REPLACE]=1;
- uc_update_queries[SQLCOM_REPLACE_SELECT]=1;
- uc_update_queries[SQLCOM_RENAME_TABLE]=1;
- uc_update_queries[SQLCOM_BACKUP_TABLE]=1;
- uc_update_queries[SQLCOM_RESTORE_TABLE]=1;
- uc_update_queries[SQLCOM_DELETE_MULTI]=1;
- uc_update_queries[SQLCOM_DROP_INDEX]=1;
- uc_update_queries[SQLCOM_MULTI_UPDATE]=1;
-}
+ SYNOPSIS
+ acl_init()
+ dont_read_acl_tables Set to 1 if run with --skip-grant
+
+ RETURN VALUES
+ 0 ok
+ 1 Could not initialize grant's
+*/
-int acl_init(bool dont_read_acl_tables)
+
+my_bool acl_init(bool dont_read_acl_tables)
{
- THD *thd;
+ THD *thd, *org_thd;
TABLE_LIST tables[3];
TABLE *table;
READ_RECORD read_record_info;
+ MYSQL_LOCK *lock;
+ my_bool return_val=1;
DBUG_ENTER("acl_init");
if (!acl_cache)
@@ -157,19 +144,21 @@ int acl_init(bool dont_read_acl_tables)
if (dont_read_acl_tables)
DBUG_RETURN(0); /* purecov: tested */
+ /*
+ To be able to run this from boot, we allocate a temporary THD
+ */
+ org_thd=current_thd; // Save for restore
if (!(thd=new THD))
DBUG_RETURN(1); /* purecov: inspected */
+ thd->store_globals();
+
acl_cache->clear(1); // Clear locked hostname cache
- thd->version=refresh_version;
- thd->mysys_var=my_thread_var;
- thd->current_tablenr=0;
- thd->open_tables=0;
thd->db= my_strdup("mysql",MYF(0));
thd->db_length=5; // Safety
bzero((char*) &tables,sizeof(tables));
- tables[0].name=tables[0].real_name=(char*) "host";
- tables[1].name=tables[1].real_name=(char*) "user";
- tables[2].name=tables[2].real_name=(char*) "db";
+ tables[0].alias=tables[0].real_name=(char*) "host";
+ tables[1].alias=tables[1].real_name=(char*) "user";
+ tables[2].alias=tables[2].real_name=(char*) "db";
tables[0].next=tables+1;
tables[1].next=tables+2;
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
@@ -177,22 +166,20 @@ int acl_init(bool dont_read_acl_tables)
if (open_tables(thd,tables))
{
- close_thread_tables(thd); /* purecov: inspected */
- delete thd; /* purecov: inspected */
- DBUG_RETURN(1); /* purecov: inspected */
+ sql_print_error("Fatal error: Can't open privilege tables: %s",
+ thd->net.last_error);
+ goto end;
}
TABLE *ptr[3]; // Lock tables for quick update
ptr[0]= tables[0].table;
ptr[1]= tables[1].table;
ptr[2]= tables[2].table;
- MYSQL_LOCK *lock=mysql_lock_tables(thd,ptr,3);
- if (!lock)
+ if (!(lock=mysql_lock_tables(thd,ptr,3)))
{
- close_thread_tables(thd); /* purecov: inspected */
- delete thd; /* purecov: inspected */
- DBUG_RETURN(1); /* purecov: inspected */
+ sql_print_error("Fatal error: Can't lock privilege tables: %s",
+ thd->net.last_error);
+ goto end;
}
-
init_sql_alloc(&mem,1024,0);
init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0);
VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50));
@@ -208,7 +195,7 @@ int acl_init(bool dont_read_acl_tables)
if (table->fields == 8)
{ // Without grant
if (host.access & CREATE_ACL)
- host.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
+ host.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL;
}
#endif
VOID(push_dynamic(&acl_hosts,(gptr) &host));
@@ -259,7 +246,6 @@ int acl_init(bool dont_read_acl_tables)
(uint) strlen(user.host.hostname) : 0);
if (table->fields >= 31) /* Starting from 4.0.2 we have more fields */
{
-#ifdef HAVE_OPENSSL
char *ssl_type=get_field(&mem, table, 24);
if (!ssl_type)
user.ssl_type=SSL_TYPE_NONE;
@@ -273,7 +259,7 @@ int acl_init(bool dont_read_acl_tables)
user.ssl_cipher= get_field(&mem, table, 25);
user.x509_issuer= get_field(&mem, table, 26);
user.x509_subject= get_field(&mem, table, 27);
-#endif
+
char *ptr = get_field(&mem, table, 28);
user.user_resource.questions=atoi(ptr);
ptr = get_field(&mem, table, 29);
@@ -286,9 +272,7 @@ int acl_init(bool dont_read_acl_tables)
}
else
{
-#ifdef HAVE_OPENSSL
user.ssl_type=SSL_TYPE_NONE;
-#endif
bzero(&(user.user_resource),sizeof(user.user_resource));
#ifndef TO_BE_REMOVED
if (table->fields <= 13)
@@ -346,12 +330,16 @@ int acl_init(bool dont_read_acl_tables)
init_check_host();
mysql_unlock_tables(thd, lock);
- init_update_queries();
+ initialized=1;
thd->version--; // Force close to free memory
+ return_val=0;
+
+end:
close_thread_tables(thd);
delete thd;
- initialized=1;
- DBUG_RETURN(0);
+ if (org_thd)
+ org_thd->store_globals(); /* purecov: inspected */
+ DBUG_RETURN(return_val);
}
@@ -374,18 +362,18 @@ void acl_free(bool end)
/* Reload acl list if possible */
-void acl_reload(void)
+void acl_reload(THD *thd)
{
DYNAMIC_ARRAY old_acl_hosts,old_acl_users,old_acl_dbs;
MEM_ROOT old_mem;
bool old_initialized;
DBUG_ENTER("acl_reload");
- if (current_thd && current_thd->locked_tables)
+ if (thd && thd->locked_tables)
{ // Can't have locked tables here
- current_thd->lock=current_thd->locked_tables;
- current_thd->locked_tables=0;
- close_thread_tables(current_thd);
+ thd->lock=thd->locked_tables;
+ thd->locked_tables=0;
+ close_thread_tables(thd);
}
if ((old_initialized=initialized))
VOID(pthread_mutex_lock(&acl_cache->lock));
@@ -399,7 +387,7 @@ void acl_reload(void)
if (acl_init(0))
{ // Error. Revert to old list
- acl_free(); /* purecov: inspected */
+ acl_free(); /* purecov: inspected */
acl_hosts=old_acl_hosts;
acl_users=old_acl_users;
acl_dbs=old_acl_dbs;
@@ -536,6 +524,7 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
if X509 certificate attributes are OK
*/
switch (acl_user->ssl_type) {
+ case SSL_TYPE_NOT_SPECIFIED: // Impossible
case SSL_TYPE_NONE: /* SSL is not required to connect */
user_access=acl_user->access;
break;
@@ -559,15 +548,17 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
use.
*/
if (acl_user->ssl_cipher)
+ {
DBUG_PRINT("info",("comparing ciphers: '%s' and '%s'",
acl_user->ssl_cipher,
SSL_get_cipher(vio->ssl_)));
- if (!strcmp(acl_user->ssl_cipher,SSL_get_cipher(vio->ssl_)))
- user_access=acl_user->access;
- else
- {
- user_access=NO_ACCESS;
- break;
+ if (!strcmp(acl_user->ssl_cipher,SSL_get_cipher(vio->ssl_)))
+ user_access=acl_user->access;
+ else
+ {
+ user_access=NO_ACCESS;
+ break;
+ }
}
/* Prepare certificate (if exists) */
DBUG_PRINT("info",("checkpoint 1"));
@@ -652,7 +643,8 @@ static void acl_update_user(const char *user, const char *host,
!strcmp(user,acl_user->user))
{
if (!acl_user->host.hostname && !host[0] ||
- acl_user->host.hostname && !strcmp(host,acl_user->host.hostname))
+ acl_user->host.hostname &&
+ !my_strcasecmp(host,acl_user->host.hostname))
{
acl_user->access=privileges;
if (mqh->bits & 1)
@@ -661,12 +653,16 @@ static void acl_update_user(const char *user, const char *host,
acl_user->user_resource.updates=mqh->updates;
if (mqh->bits & 4)
acl_user->user_resource.connections=mqh->connections;
-#ifdef HAVE_OPENSSL
- acl_user->ssl_type=ssl_type;
- acl_user->ssl_cipher=ssl_cipher;
- acl_user->x509_issuer=x509_issuer;
- acl_user->x509_subject=x509_subject;
-#endif /* HAVE_OPENSSL */
+ if (ssl_type != SSL_TYPE_NOT_SPECIFIED)
+ {
+ acl_user->ssl_type= ssl_type;
+ acl_user->ssl_cipher= (ssl_cipher ? strdup_root(&mem,ssl_cipher) :
+ 0);
+ acl_user->x509_issuer= (x509_issuer ? strdup_root(&mem,x509_issuer) :
+ 0);
+ acl_user->x509_subject= (x509_subject ?
+ strdup_root(&mem,x509_subject) : 0);
+ }
if (password)
{
if (!password[0])
@@ -701,12 +697,11 @@ static void acl_insert_user(const char *user, const char *host,
acl_user.user_resource = *mqh;
acl_user.sort=get_sort(2,acl_user.host.hostname,acl_user.user);
acl_user.hostname_length=(uint) strlen(acl_user.host.hostname);
-#ifdef HAVE_OPENSSL
- acl_user.ssl_type=ssl_type;
- acl_user.ssl_cipher=ssl_cipher;
- acl_user.x509_issuer=x509_issuer;
- acl_user.x509_subject=x509_subject;
-#endif /* HAVE_OPENSSL */
+ acl_user.ssl_type= (ssl_type != SSL_TYPE_NOT_SPECIFIED ?
+ ssl_type : SSL_TYPE_NONE);
+ acl_user.ssl_cipher= ssl_cipher ? strdup_root(&mem,ssl_cipher) : 0;
+ acl_user.x509_issuer= x509_issuer ? strdup_root(&mem,x509_issuer) : 0;
+ acl_user.x509_subject=x509_subject ? strdup_root(&mem,x509_subject) : 0;
if (password)
{
acl_user.password=(char*) ""; // Just point at something
@@ -738,7 +733,7 @@ static void acl_update_db(const char *user, const char *host, const char *db,
!strcmp(user,acl_db->user))
{
if (!acl_db->host.hostname && !host[0] ||
- acl_db->host.hostname && !strcmp(host,acl_db->host.hostname))
+ acl_db->host.hostname && !my_strcasecmp(host,acl_db->host.hostname))
{
if (!acl_db->db && !db[0] ||
acl_db->db && !strcmp(db,acl_db->db))
@@ -754,11 +749,25 @@ static void acl_update_db(const char *user, const char *host, const char *db,
}
+/*
+ Insert a user/db/host combination into the global acl_cache
+
+ SYNOPSIS
+ acl_insert_db()
+ user User name
+ host Host name
+ db Database name
+ privileges Bitmap of privileges
+
+ NOTES
+ acl_cache->lock must be locked when calling this
+*/
+
static void acl_insert_db(const char *user, const char *host, const char *db,
ulong privileges)
{
ACL_DB acl_db;
- /* The acl_cache mutex is locked by mysql_grant */
+ safe_mutex_assert_owner(&acl_cache->lock);
acl_db.user=strdup_root(&mem,user);
update_hostname(&acl_db.host,strdup_root(&mem,host));
acl_db.db=strdup_root(&mem,db);
@@ -782,7 +791,6 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip,
db_access=0; host_access= ~0;
char key[ACL_KEY_LENGTH],*tmp_db,*end;
acl_entry *entry;
- THD *thd= current_thd;
VOID(pthread_mutex_lock(&acl_cache->lock));
memcpy_fixed(&key,bin_ip,sizeof(struct in_addr));
@@ -1016,6 +1024,21 @@ bool check_change_password(THD *thd, const char *host, const char *user)
}
+/*
+ Change a password for a user
+
+ SYNOPSIS
+ change_password()
+ thd Thread handle
+ host Hostname
+ user User name
+ new_password New password for host@user
+
+ RETURN VALUES
+ 0 ok
+ 1 ERROR; In this case the error is sent to the client.
+*/
+
bool change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
@@ -1167,7 +1190,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_PRINT("enter",("user: %s host: %s",user,host));
bzero((char*) &tables,sizeof(tables));
- tables.name=tables.real_name=(char*) "user";
+ tables.alias=tables.real_name=(char*) "user";
tables.db=(char*) "mysql";
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
DBUG_RETURN(1); /* purecov: deadcode */
@@ -1233,6 +1256,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
char *password,empty_string[1];
char what= (revoke_grant) ? 'N' : 'Y';
DBUG_ENTER("replace_user_table");
+ safe_mutex_assert_owner(&acl_cache->lock);
password=empty_string;
empty_string[0]=0;
@@ -1256,7 +1280,6 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
{
if (!create_user)
{
- THD *thd=current_thd;
if (what == 'N')
my_printf_error(ER_NONEXISTING_GRANT,ER(ER_NONEXISTING_GRANT),
MYF(0),combo.user.str,combo.host.str);
@@ -1298,20 +1321,25 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
DBUG_PRINT("info",("table->fields: %d",table->fields));
if (table->fields >= 31) /* From 4.0.0 we have more fields */
{
-#ifdef HAVE_OPENSSL
/* We write down SSL related ACL stuff */
- table->field[25]->store("", 0, system_charset_info);
- table->field[26]->store("", 0, system_charset_info);
- table->field[27]->store("", 0, system_charset_info);
switch (thd->lex.ssl_type) {
case SSL_TYPE_ANY:
table->field[24]->store("ANY",3, system_charset_info);
+ table->field[25]->store("", 0, system_charset_info);
+ table->field[26]->store("", 0, system_charset_info);
+ table->field[27]->store("", 0, system_charset_info);
break;
case SSL_TYPE_X509:
table->field[24]->store("X509",4, system_charset_info);
+ table->field[25]->store("", 0, system_charset_info);
+ table->field[26]->store("", 0, system_charset_info);
+ table->field[27]->store("", 0, system_charset_info);
break;
case SSL_TYPE_SPECIFIED:
table->field[24]->store("SPECIFIED",9, system_charset_info);
+ table->field[25]->store("", 0, system_charset_info);
+ table->field[26]->store("", 0, system_charset_info);
+ table->field[27]->store("", 0, system_charset_info);
if (thd->lex.ssl_cipher)
table->field[25]->store(thd->lex.ssl_cipher,
strlen(thd->lex.ssl_cipher), system_charset_info);
@@ -1322,10 +1350,10 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
table->field[27]->store(thd->lex.x509_subject,
strlen(thd->lex.x509_subject), system_charset_info);
break;
- default:
- table->field[24]->store("", 0, system_charset_info);
+ case SSL_TYPE_NOT_SPECIFIED:
+ case SSL_TYPE_NONE: // Impossible
+ break; // Nothing to do
}
-#endif /* HAVE_OPENSSL */
USER_RESOURCES mqh = thd->lex.mqh;
if (mqh.bits & 1)
@@ -1634,6 +1662,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
char helping [NAME_LEN*2+USERNAME_LENGTH+3];
uint len;
GRANT_TABLE *grant_table,*found=0;
+ safe_mutex_assert_owner(&LOCK_grant);
len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1;
for (grant_table=(GRANT_TABLE*) hash_search(&hash_tables,(byte*) helping,
@@ -1643,7 +1672,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
{
if (exact)
{
- if ((host && !strcmp(host,grant_table->host)) ||
+ if ((host && !my_strcasecmp(host,grant_table->host)) ||
(ip && !strcmp(ip,grant_table->host)))
return grant_table;
}
@@ -1843,6 +1872,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
int error=0;
ulong store_table_rights, store_col_rights;
DBUG_ENTER("replace_table_table");
+ safe_mutex_assert_owner(&LOCK_grant);
strxmov(grantor, thd->user, "@", thd->host_or_ip, NullS);
@@ -1983,7 +2013,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
check->column.length(),0,0))
{
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0),
- check->column.c_ptr(),table_list->name);
+ check->column.c_ptr(), table_list->alias);
DBUG_RETURN(-1);
}
column_priv |= check->rights | (rights & COL_ACLS);
@@ -1993,12 +2023,12 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
else if (!(rights & CREATE_ACL) && !revoke_grant)
{
char buf[FN_REFLEN];
- sprintf(buf,"%s/%s/%s.frm",mysql_data_home,table_list->db,
- table_list->name);
+ sprintf(buf,"%s/%s/%s.frm",mysql_data_home, table_list->db,
+ table_list->real_name);
fn_format(buf,buf,"","",4+16+32);
if (access(buf,F_OK))
{
- my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db,table_list->name);
+ my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db, table_list->alias);
DBUG_RETURN(-1);
}
}
@@ -2006,9 +2036,9 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
/* open the mysql.tables_priv and mysql.columns_priv tables */
bzero((char*) &tables,sizeof(tables));
- tables[0].name=tables[0].real_name= (char*) "user";
- tables[1].name=tables[1].real_name= (char*) "tables_priv";
- tables[2].name=tables[2].real_name= (char*) "columns_priv";
+ tables[0].alias=tables[0].real_name= (char*) "user";
+ tables[1].alias=tables[1].real_name= (char*) "tables_priv";
+ tables[2].alias=tables[2].real_name= (char*) "columns_priv";
tables[0].next=tables+1;
/* Don't open column table if we don't need it ! */
tables[1].next=((column_priv ||
@@ -2032,6 +2062,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
while ((Str = str_list++))
{
+ int error;
GRANT_TABLE *grant_table;
if (!Str->host.str)
{
@@ -2046,8 +2077,11 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
continue;
}
/* Create user if needed */
- if (replace_user_table(thd, tables[0].table, *Str,
- 0, revoke_grant, create_new_users))
+ pthread_mutex_lock(&acl_cache->lock);
+ error=replace_user_table(thd, tables[0].table, *Str,
+ 0, revoke_grant, create_new_users);
+ pthread_mutex_unlock(&acl_cache->lock);
+ if (error)
{
result= -1; // Remember error
continue; // Add next user
@@ -2056,20 +2090,20 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
/* Find/create cached table grant */
grant_table= table_hash_search(Str->host.str,NullS,table_list->db,
Str->user.str,
- table_list->name,1);
+ table_list->real_name,1);
if (!grant_table)
{
if (revoke_grant)
{
my_printf_error(ER_NONEXISTING_TABLE_GRANT,
ER(ER_NONEXISTING_TABLE_GRANT),MYF(0),
- Str->user.str, Str->host.str,table_list->name);
+ Str->user.str, Str->host.str, table_list->real_name);
result= -1;
continue;
}
grant_table = new GRANT_TABLE (Str->host.str,table_list->db,
Str->user.str,
- table_list->name,
+ table_list->real_name,
rights,
column_priv);
if (!grant_table) // end of memory
@@ -2116,7 +2150,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
if (replace_table_table(thd,grant_table,tables[1].table,*Str,
table_list->db,
- table_list->name,
+ table_list->real_name,
rights, column_priv, revoke_grant))
{ // Crashend table ??
result= -1; /* purecov: deadcode */
@@ -2126,7 +2160,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
if ((replace_column_table(grant_table,tables[2].table, *Str,
columns,
table_list->db,
- table_list->name,
+ table_list->real_name,
rights, revoke_grant)))
{
result= -1;
@@ -2168,8 +2202,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
/* open the mysql.user and mysql.db tables */
- tables[0].name=tables[0].real_name=(char*) "user";
- tables[1].name=tables[1].real_name=(char*) "db";
+ tables[0].alias=tables[0].real_name=(char*) "user";
+ tables[1].alias=tables[1].real_name=(char*) "db";
tables[0].next=tables+1;
tables[1].next=0;
tables[0].lock_type=tables[1].lock_type=TL_WRITE;
@@ -2241,11 +2275,12 @@ void grant_free(void)
/* Init grant array if possible */
-int grant_init (void)
+my_bool grant_init(void)
{
- THD *thd;
+ THD *thd, *org_thd;
TABLE_LIST tables[2];
- int error = 0;
+ MYSQL_LOCK *lock;
+ my_bool return_val= 1;
TABLE *t_table, *c_table;
DBUG_ENTER("grant_init");
@@ -2255,79 +2290,69 @@ int grant_init (void)
(hash_free_key) free_grant_table,0);
init_sql_alloc(&memex,1024,0);
+ /* Don't do anything if running with --skip-grant */
if (!initialized)
DBUG_RETURN(0); /* purecov: tested */
+
+ org_thd=current_thd;
if (!(thd=new THD))
DBUG_RETURN(1); /* purecov: deadcode */
-
- thd->version=refresh_version;
- thd->mysys_var=my_thread_var;
- thd->current_tablenr=0;
- thd->open_tables=0;
+ thd->store_globals();
thd->db= my_strdup("mysql",MYF(0));
thd->db_length=5; // Safety
bzero((char*) &tables,sizeof(tables));
- tables[0].name=tables[0].real_name= (char*) "tables_priv";
- tables[1].name=tables[1].real_name= (char*) "columns_priv";
+ tables[0].alias=tables[0].real_name= (char*) "tables_priv";
+ tables[1].alias=tables[1].real_name= (char*) "columns_priv";
tables[0].next=tables+1;
tables[0].lock_type=tables[1].lock_type=TL_READ;
tables[0].db=tables[1].db=thd->db;
if (open_tables(thd,tables))
- { // No grant tables
- close_thread_tables(thd); /* purecov: deadcode */
- delete thd; /* purecov: deadcode */
- DBUG_RETURN(1); /* purecov: deadcode */
- }
+ goto end;
+
TABLE *ptr[2]; // Lock tables for quick update
ptr[0]= tables[0].table;
ptr[1]= tables[1].table;
- MYSQL_LOCK *lock=mysql_lock_tables(thd,ptr,2);
- if (!lock)
- {
- close_thread_tables(thd); /* purecov: deadcode */
- delete thd; /* purecov: deadcode */
- DBUG_RETURN(1); /* purecov: deadcode */
- }
+ if (!(lock=mysql_lock_tables(thd,ptr,2)))
+ goto end;
t_table = tables[0].table; c_table = tables[1].table;
t_table->file->index_init(0);
if (t_table->file->index_first(t_table->record[0]))
{
t_table->file->index_end();
- mysql_unlock_tables(thd, lock);
- thd->version--; // Force close to free memory
- close_thread_tables(thd);
- delete thd;
- DBUG_RETURN(0); // Empty table is ok!
+ goto end_unlock;
}
grant_option= TRUE;
t_table->file->index_end();
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ /* Will be restored by org_thd->store_globals() */
my_pthread_setspecific_ptr(THR_MALLOC,&memex);
- while (!error)
+ do
{
GRANT_TABLE *mem_check;
if (!(mem_check=new GRANT_TABLE(t_table,c_table)) ||
mem_check->ok() && hash_insert(&hash_tables,(byte*) mem_check))
{
/* This could only happen if we are out memory */
- my_pthread_setspecific_ptr(THR_MALLOC,old_root); /* purecov: deadcode */
grant_option = FALSE; /* purecov: deadcode */
- mysql_unlock_tables(thd, lock); /* purecov: deadcode */
- close_thread_tables(thd); /* purecov: deadcode */
- delete thd; /* purecov: deadcode */
- DBUG_RETURN(1); /* purecov: deadcode */
+ goto end_unlock;
}
- error = t_table->file->index_next(t_table->record[0]);
}
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ while (!t_table->file->index_next(t_table->record[0]));
+
+ return_val=0; // Return ok
+
+end_unlock:
mysql_unlock_tables(thd, lock);
thd->version--; // Force close to free memory
+
+end:
close_thread_tables(thd);
delete thd;
- DBUG_RETURN(0);
+ if (org_thd)
+ org_thd->store_globals();
+ DBUG_RETURN(return_val);
}
@@ -2604,6 +2629,7 @@ bool check_grant_db(THD *thd,const char *db)
ulong get_table_grant(THD *thd, TABLE_LIST *table)
{
+ ulong privilege;
char *user = thd->priv_user;
const char *db = table->db ? table->db : thd->db;
GRANT_TABLE *grant_table;
@@ -2615,8 +2641,9 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table)
table->grant.version=grant_version;
if (grant_table)
table->grant.privilege|= grant_table->privs;
+ privilege= table->grant.privilege;
rw_unlock(&LOCK_grant);
- return table->grant.privilege;
+ return privilege;
}
@@ -2707,7 +2734,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (!(host=acl_user->host.hostname))
host="%";
if (!strcmp(lex_user->user.str,user) &&
- !strcmp(lex_user->host.str,host))
+ !my_strcasecmp(lex_user->host.str,host))
break;
}
if (counter == acl_users.elements)
@@ -2727,10 +2754,12 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (send_fields(thd,field_list,1))
DBUG_RETURN(-1);
+ rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
/* Add first global access grants */
- if (acl_user->access || acl_user->password)
+ if (acl_user->access || acl_user->password ||
+ acl_user->ssl_type != SSL_TYPE_NONE)
{
want_access=acl_user->access;
String global(buff,sizeof(buff),system_charset_info);
@@ -2769,7 +2798,6 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
global.append(passd_buff);
global.append('\'');
}
-#ifdef HAVE_OPENSSL
/* "show grants" SSL related stuff */
if (acl_user->ssl_type == SSL_TYPE_ANY)
global.append(" REQUIRE SSL",12);
@@ -2782,28 +2810,27 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (acl_user->x509_issuer)
{
ssl_options++;
- global.append("ISSUER \"",8);
+ global.append("ISSUER \'",8);
global.append(acl_user->x509_issuer,strlen(acl_user->x509_issuer));
global.append('\'');
}
if (acl_user->x509_subject)
{
if (ssl_options++)
- global.append(" AND ",5);
- global.append("SUBJECT \"",9);
+ global.append(' ');
+ global.append("SUBJECT \'",9);
global.append(acl_user->x509_subject,strlen(acl_user->x509_subject));
global.append('\'');
}
if (acl_user->ssl_cipher)
{
if (ssl_options++)
- global.append(" AND ",5);
+ global.append(' ');
global.append("CIPHER '",8);
global.append(acl_user->ssl_cipher,strlen(acl_user->ssl_cipher));
global.append('\'');
}
}
-#endif /* HAVE_OPENSSL */
if ((want_access & GRANT_ACL) ||
(acl_user->user_resource.questions | acl_user->user_resource.updates |
acl_user->user_resource.connections))
@@ -2854,7 +2881,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
- !strcmp(lex_user->host.str,host))
+ !my_strcasecmp(lex_user->host.str,host))
{
want_access=acl_db->access;
if (want_access)
@@ -2913,7 +2940,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
- !strcmp(lex_user->host.str,host))
+ !my_strcasecmp(lex_user->host.str,host))
{
want_access=grant_table->privs;
if ((want_access | grant_table->cols) != 0)
@@ -2982,14 +3009,16 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (my_net_write(&thd->net,(char*) thd->packet.ptr(),
thd->packet.length()))
{
- error=-1;
- goto end;
+ error= -1;
+ break;
}
}
}
}
end:
VOID(pthread_mutex_unlock(&acl_cache->lock));
+ rw_unlock(&LOCK_grant);
+
send_eof(thd);
DBUG_RETURN(error);
}
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index d6cf320c978..326a55ddd0c 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -40,7 +40,7 @@
#define DB_ACLS \
(UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
- GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
+ GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | LOCK_TABLES_ACL)
#define TABLE_ACLS \
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
@@ -59,10 +59,21 @@
#define EXTRA_ACL (1L << 29)
#define NO_ACCESS (1L << 30)
-/* defines to change the above bits to how things are stored in tables */
+/*
+ Defines to change the above bits to how things are stored in tables
+ This is needed as the 'host' and 'db' table is missing a few privileges
+*/
+
+/* Continius bit-segments that needs to be shifted */
+#define DB_REL1 (RELOAD_ACL | SHUTDOWN_ACL | PROCESS_ACL | FILE_ACL)
+#define DB_REL2 (GRANT_ACL | REFERENCES_ACL)
+
+/* Privileges that needs to be reallocated (in continous chunks) */
+#define DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
+#define DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL)
-#define fix_rights_for_db(A) (((A) & 63) | (((A) & ~63) << 4))
-#define get_rights_for_db(A) (((A) & 63) | (((A) & ~63) >> 4))
+#define fix_rights_for_db(A) (((A) & 63) | (((A) & DB_REL1) << 4) | (((A) & DB_REL2) << 6))
+#define get_rights_for_db(A) (((A) & 63) | (((A) & DB_CHUNK1) >> 4) | (((A) & DB_CHUNK2) >> 6))
#define fix_rights_for_table(A) (((A) & 63) | (((A) & ~63) << 4))
#define get_rights_for_table(A) (((A) & 63) | (((A) & ~63) >> 4))
#define fix_rights_for_column(A) (((A) & COL_ACLS) | ((A & ~COL_ACLS) << 7))
@@ -70,8 +81,8 @@
/* prototypes */
-int acl_init(bool dont_read_acl_tables);
-void acl_reload(void);
+my_bool acl_init(bool dont_read_acl_tables);
+void acl_reload(THD *thd);
void acl_free(bool end=0);
ulong acl_get(const char *host, const char *ip, const char *bin_ip,
const char *user, const char *db);
@@ -87,7 +98,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
List <LEX_COLUMN> &column_list, ulong rights,
bool revoke);
-int grant_init(void);
+my_bool grant_init(void);
void grant_free(void);
void grant_reload(void);
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 5d3421f5538..9f1d717a3c3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -158,7 +158,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
table_list.db= (char*) entry->table_cache_key;
table_list.real_name= entry->real_name;
table_list.grant.privilege=0;
- if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list))
+ if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
continue;
/* need to check if we haven't already listed it */
@@ -530,7 +530,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
bool found=0;
for (TABLE_LIST *table=tables ; table ; table=table->next)
{
- if (remove_table_from_cache(thd, table->db, table->name, 1))
+ if (remove_table_from_cache(thd, table->db, table->real_name, 1))
found=1;
}
if (!found)
@@ -890,7 +890,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
DBUG_RETURN(0);
char* db = thd->db ? thd->db : table_list->db;
- char* table_name = table_list->name;
+ char* table_name = table_list->real_name;
char key[MAX_DBKEY_LENGTH];
uint key_length;
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
@@ -1447,7 +1447,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
TABLE_LIST table_list;
table_list.db=(char*) db;
- table_list.name=(char*) name;
+ table_list.real_name=(char*) name;
table_list.next=0;
safe_mutex_assert_owner(&LOCK_open);
@@ -1519,7 +1519,7 @@ int open_tables(THD *thd,TABLE_LIST *start)
!(tables->table=open_table(thd,
tables->db,
tables->real_name,
- tables->name, &refresh)))
+ tables->alias, &refresh)))
{
if (refresh) // Refresh in progress
{
@@ -1575,7 +1575,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
thd->proc_info="Opening table";
while (!(table=open_table(thd,table_list->db,
- table_list->real_name,table_list->name,
+ table_list->real_name,table_list->alias,
&refresh)) && refresh) ;
if (table)
{
@@ -1599,7 +1599,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
{
my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,
ER(ER_TABLE_NOT_LOCKED_FOR_WRITE),
- MYF(0),table_list->name);
+ MYF(0),table_list->alias);
table=0;
}
else if ((error=table->file->start_stmt(thd)))
@@ -1796,7 +1796,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
bool found_table=0;
for (; tables ; tables=tables->next)
{
- if (!strcmp(tables->name,table_name) &&
+ if (!strcmp(tables->alias,table_name) &&
(!db || !strcmp(db,tables->db)))
{
found_table=1;
@@ -1940,9 +1940,19 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (item->type() == Item::FIELD_ITEM &&
((Item_field*) item)->field_name[0] == '*')
{
+ uint elem=fields.elements;
if (insert_fields(thd,tables,((Item_field*) item)->db_name,
((Item_field*) item)->table_name,&it))
DBUG_RETURN(-1); /* purecov: inspected */
+ if (sum_func_list)
+ {
+ /*
+ sum_func_list is a list that has the fields list as a tail.
+ Because of this we have to update the element count also for this
+ list after expanding the '*' entry.
+ */
+ sum_func_list->elements+= fields.elements - elem;
+ }
}
else
{
@@ -2053,7 +2063,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
if (grant_option && !thd->master_access &&
check_grant_all_columns(thd,SELECT_ACL,table) )
DBUG_RETURN(-1);
- if (!table_name || (!strcmp(table_name,tables->name) &&
+ if (!table_name || (!strcmp(table_name,tables->alias) &&
(!db_name || !strcmp(tables->db,db_name))))
{
Field **ptr=table->field,*field;
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index f14230913c7..7c51cac0f3a 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -723,11 +723,11 @@ Query_cache::Query_cache(ulong query_cache_limit,
def_table_hash_size(ALIGN_SIZE(def_table_hash_size)),
initialized(0)
{
- ulong min_needed=(ALIGN_SIZE(sizeof(Query_cache_block)) +
- ALIGN_SIZE(sizeof(Query_cache_block_table)) +
- ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
+ ulong min_needed= (ALIGN_SIZE(sizeof(Query_cache_block)) +
+ ALIGN_SIZE(sizeof(Query_cache_block_table)) +
+ ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
set_if_bigger(min_allocation_unit,min_needed);
- this->min_allocation_unit = ALIGN_SIZE(min_allocation_unit);
+ this->min_allocation_unit= ALIGN_SIZE(min_allocation_unit);
set_if_bigger(this->min_result_data_size,min_allocation_unit);
}
@@ -738,7 +738,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
DBUG_PRINT("qcache", ("from %lu to %lu",query_cache_size,
query_cache_size_arg));
free_cache(0);
- query_cache_size=query_cache_size_arg;
+ query_cache_size= query_cache_size_arg;
DBUG_RETURN(init_cache());
}
@@ -979,12 +979,12 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_table *table = block_table->parent;
table_list.db = table->db();
- table_list.name = table_list.real_name = table->table();
+ table_list.alias= table_list.real_name= table->table();
if (check_table_access(thd,SELECT_ACL,&table_list,1))
{
DBUG_PRINT("qcache",
("probably no SELECT access to %s.%s => return to normal processing",
- table_list.db, table_list.name));
+ table_list.db, table_list.alias));
refused++; // This is actually a hit
STRUCT_UNLOCK(&structure_guard_mutex);
thd->safe_to_cache_query=0; // Don't try to cache this
@@ -994,7 +994,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
if (table_list.grant.want_privilege)
{
DBUG_PRINT("qcache", ("Need to check column privileges for %s.%s",
- table_list.db, table_list.name));
+ table_list.db, table_list.alias));
BLOCK_UNLOCK_RD(query_block);
thd->safe_to_cache_query=0; // Don't try to cache this
goto err_unlock; // Parse query
@@ -1120,6 +1120,28 @@ void Query_cache::invalidate(THD *thd, TABLE *table,
DBUG_VOID_RETURN;
}
+void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length,
+ my_bool using_transactions)
+{
+ DBUG_ENTER("Query_cache::invalidate (key)");
+
+ if (query_cache_size > 0)
+ {
+ using_transactions = using_transactions &&
+ (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
+ if (using_transactions) // used for innodb => has_transactions() is TRUE
+ thd->add_changed_table(key, key_length);
+ else
+ {
+ STRUCT_LOCK(&structure_guard_mutex);
+ if (query_cache_size > 0)
+ invalidate_table((byte*)key, key_length);
+ STRUCT_UNLOCK(&structure_guard_mutex);
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
/*
Remove all cached queries that uses the given database
*/
@@ -1372,8 +1394,14 @@ ulong Query_cache::init_cache()
VOID(hash_init(&queries,system_charset_info,def_query_hash_size, 0, 0,
query_cache_query_get_key, 0, 0));
+ /*
+ On windows we have to compare names case insensitive as for the OS
+ A.frm and a.frm are the same file.
+ */
VOID(hash_init(&tables,system_charset_info,def_table_hash_size, 0, 0,
- query_cache_table_get_key, 0, 0));
+ query_cache_table_get_key, 0,
+ IF_WIN((lower_case_table_names ? 0: HASH_CASE_INSENSITIVE),
+ 0)));
queries_in_cache = 0;
queries_blocks = 0;
@@ -2844,7 +2872,6 @@ uint Query_cache::filename_2_table_key (char *key, const char *path,
filename) -key) + 1);
}
-
/****************************************************************************
Functions to be used when debugging
****************************************************************************/
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 3088331f19a..f19e6630da5 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -170,16 +170,16 @@ struct Query_cache_result
};
-extern "C" {
+extern "C"
+{
byte *query_cache_query_get_key(const byte *record, uint *length,
my_bool not_used);
byte *query_cache_table_get_key(const byte *record, uint *length,
my_bool not_used);
- void query_cache_insert(THD *thd, const char *packet, ulong length);
- void query_cache_end_of_result(THD *thd);
- void query_cache_abort(THD *thd);
- void query_cache_invalidate_by_MyISAM_filename(const char* filename);
}
+void query_cache_insert(NET *thd, const char *packet, ulong length);
+void query_cache_invalidate_by_MyISAM_filename(const char* filename);
+
struct Query_cache_memory_bin
{
@@ -361,6 +361,8 @@ protected:
my_bool using_transactions);
void invalidate(CHANGED_TABLE_LIST *tables_used);
void invalidate(THD* thd, TABLE *table, my_bool using_transactions);
+ void invalidate(THD *thd, const char *key, uint32 key_length,
+ my_bool using_transactions);
/* Remove all queries that uses any of the tables in following database */
void invalidate(char *db);
@@ -399,7 +401,6 @@ protected:
extern Query_cache query_cache;
extern TYPELIB query_cache_type_typelib;
-void query_cache_insert(NET *net, const char *packet, ulong length);
void query_cache_end_of_result(NET *net);
void query_cache_abort(NET *net);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 277492bcea6..09f5a78fcc8 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -93,6 +93,7 @@ THD::THD():user_time(0), fatal_error(0),
query_error=0;
next_insert_id=last_insert_id=0;
open_tables=temporary_tables=handler_tables=0;
+ current_tablenr=0;
handler_items=0;
tmp_table=0;
lock=locked_tables=0;
@@ -110,6 +111,7 @@ THD::THD():user_time(0), fatal_error(0),
dbug_sentry=THD_SENTRY_MAGIC;
#endif
net.vio=0;
+ net.last_error[0]=0; // If error on boot
ull=0;
system_thread=cleanup_done=0;
transaction.changed_tables = 0;
@@ -138,6 +140,7 @@ THD::THD():user_time(0), fatal_error(0),
command=COM_CONNECT;
set_query_id=1;
db_access=NO_ACCESS;
+ version=refresh_version; // For boot
/* Initialize sub structures */
bzero((char*) &mem_root,sizeof(mem_root));
@@ -285,8 +288,12 @@ void THD::awake(bool prepare_to_die)
bool THD::store_globals()
{
- return (my_pthread_setspecific_ptr(THR_THD, this) ||
- my_pthread_setspecific_ptr(THR_MALLOC, &mem_root));
+ if (my_pthread_setspecific_ptr(THR_THD, this) ||
+ my_pthread_setspecific_ptr(THR_MALLOC, &mem_root))
+ return 1;
+ mysys_var=my_thread_var;
+ dbug_thread_id=my_thread_id();
+ return 0;
}
@@ -311,28 +318,34 @@ void THD::add_changed_table(TABLE *table)
DBUG_ASSERT((options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
table->file->has_transactions());
+ add_changed_table(table->table_cache_key, table->key_length);
+ DBUG_VOID_RETURN;
+}
+void THD::add_changed_table(const char *key, long key_length)
+{
+ DBUG_ENTER("THD::add_changed_table(key)");
CHANGED_TABLE_LIST** prev = &transaction.changed_tables;
CHANGED_TABLE_LIST* curr = transaction.changed_tables;
for (; curr; prev = &(curr->next), curr = curr->next)
{
- int cmp = (long)curr->key_length - (long)table->key_length;
+ int cmp = (long)curr->key_length - (long)key_length;
if (cmp < 0)
{
- list_include(prev, curr, changed_table_dup(table));
+ list_include(prev, curr, changed_table_dup(key, key_length));
DBUG_PRINT("info",
- ("key_length %u %u", table->key_length, (*prev)->key_length));
+ ("key_length %u %u", key_length, (*prev)->key_length));
DBUG_VOID_RETURN;
}
else if (cmp == 0)
{
- cmp = memcmp(curr->key ,table->table_cache_key, curr->key_length);
+ cmp = memcmp(curr->key, key, curr->key_length);
if (cmp < 0)
{
- list_include(prev, curr, changed_table_dup(table));
+ list_include(prev, curr, changed_table_dup(key, key_length));
DBUG_PRINT("info",
- ("key_length %u %u", table->key_length,
+ ("key_length %u %u", key_length,
(*prev)->key_length));
DBUG_VOID_RETURN;
}
@@ -343,22 +356,22 @@ void THD::add_changed_table(TABLE *table)
}
}
}
- *prev = changed_table_dup(table);
- DBUG_PRINT("info", ("key_length %u %u", table->key_length,
+ *prev = changed_table_dup(key, key_length);
+ DBUG_PRINT("info", ("key_length %u %u", key_length,
(*prev)->key_length));
DBUG_VOID_RETURN;
}
-CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
+CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
{
CHANGED_TABLE_LIST* new_table =
(CHANGED_TABLE_LIST*) trans_alloc(ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST))+
- table->key_length + 1);
+ key_length + 1);
if (!new_table)
{
my_error(EE_OUTOFMEMORY, MYF(ME_BELL),
- ALIGN_SIZE(sizeof(TABLE_LIST)) + table->key_length + 1);
+ ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
killed= 1;
return 0;
}
@@ -366,12 +379,24 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
new_table->key = (char *) (((byte*)new_table)+
ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST)));
new_table->next = 0;
- new_table->key_length = table->key_length;
- ::memcpy(new_table->key, table->table_cache_key, table->key_length);
+ new_table->key_length = key_length;
+ ::memcpy(new_table->key, key, key_length);
return new_table;
}
+#ifdef SIGNAL_WITH_VIO_CLOSE
+void THD::close_active_vio()
+{
+ safe_mutex_assert_owner(&LOCK_delete);
+ if (active_vio)
+ {
+ vio_close(active_vio);
+ active_vio = 0;
+ }
+}
+#endif
+
/*****************************************************************************
** Functions to provide a interface to select results
*****************************************************************************/
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 8e9ef783826..a986326fe5d 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -544,15 +544,7 @@ public:
active_vio = 0;
pthread_mutex_unlock(&LOCK_delete);
}
- inline void close_active_vio()
- {
- safe_mutex_assert_owner(&LOCK_delete);
- if (active_vio)
- {
- vio_close(active_vio);
- active_vio = 0;
- }
- }
+ void THD::close_active_vio();
#endif
void awake(bool prepare_to_die);
inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex,
@@ -627,7 +619,8 @@ public:
return alloc_root(&transaction.mem_root,size);
}
void add_changed_table(TABLE *table);
- CHANGED_TABLE_LIST * changed_table_dup(TABLE *table);
+ void add_changed_table(const char *key, long key_length);
+ CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
};
/*
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 708a016f727..1d843b78d4e 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -537,7 +537,7 @@ bool mysql_change_db(THD *thd, const char *name)
int length, db_length;
char *dbname=my_strdup((char*) name,MYF(MY_WME));
char path[FN_REFLEN];
- uint db_access;
+ ulong db_access;
HA_CREATE_INFO create;
DBUG_ENTER("mysql_change_db");
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 4191973b325..ea15f2e5417 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -57,7 +57,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
// there can be only one table in *tables
if (!(tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
{
- my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->name);
+ my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias);
mysql_ha_close(thd, tables,1);
return -1;
}
@@ -68,7 +68,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
{
- TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->name);
+ TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias);
if (*ptr)
{
@@ -79,7 +79,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
else
{
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
- tables->name,"HANDLER");
+ tables->alias, "HANDLER");
return -1;
}
if (!dont_send_ok)
@@ -97,11 +97,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
ha_rows select_limit,ha_rows offset_limit)
{
int err, keyno=-1;
- TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->name);
+ TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias);
if (!table)
{
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
- tables->name,"HANDLER");
+ tables->alias,"HANDLER");
return -1;
}
tables->table=table;
@@ -114,7 +114,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0)
{
my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0),
- keyname,tables->name);
+ keyname,tables->alias);
return -1;
}
table->file->index_init(keyno);
@@ -126,7 +126,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
uint num_rows;
it++;
- insert_fields(thd,tables,tables->db,tables->name,&it);
+ insert_fields(thd,tables,tables->db,tables->alias,&it);
table->file->init_table_handle_for_HANDLER(); // Only InnoDB requires it
@@ -258,7 +258,7 @@ err0:
here for alias, not real table name
*/
static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
- const char *table_name)
+ const char *alias)
{
int dblen;
TABLE **ptr;
@@ -271,9 +271,9 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
for (TABLE *table=*ptr; table ; table=*ptr)
{
if (!memcmp(table->table_cache_key, db, dblen) &&
- !my_strcasecmp(system_charset_info,table->table_name,table_name))
+ !my_strcasecmp(system_charset_info,table->table_name,alias))
break;
- ptr=&(table->next);
+ ptr= &(table->next);
}
return ptr;
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 2852ac8b45d..b0e52d95808 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -74,7 +74,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
table_list.db= table->table_cache_key;
- table_list.name=table->table_name;
+ table_list.real_name= table_list.alias= table->table_name;
table_list.table=table;
table_list.grant=table->grant;
@@ -202,6 +202,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
thd->variables.read_buff_size);
table->file->extra_opt(HA_EXTRA_BULK_INSERT_BEGIN,
thd->variables.bulk_insert_buff_size);
+ table->bulk_insert= 1;
}
while ((values= its++))
@@ -290,6 +291,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
error=1;
}
}
+ table->bulk_insert= 0;
}
if (id && values_list.elements != 1)
thd->insert_id(id); // For update log
@@ -653,7 +655,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
}
tmp->table_list= *table_list; // Needed to open table
tmp->table_list.db= tmp->thd.db;
- tmp->table_list.name= tmp->table_list.real_name=tmp->thd.query;
+ tmp->table_list.alias= tmp->table_list.real_name=tmp->thd.query;
tmp->lock();
pthread_mutex_lock(&tmp->mutex);
if ((error=pthread_create(&tmp->thd.real_id,&connection_attrib,
@@ -941,8 +943,6 @@ static pthread_handler_decl(handle_delayed_insert,arg)
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
goto end;
}
- thd->mysys_var=my_thread_var;
- thd->dbug_thread_id=my_thread_id();
#if !defined(__WIN__) && !defined(OS2)
sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 1af8d363fda..fc6265f05af 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -180,15 +180,14 @@ static int find_keyword(LEX *lex, uint len, bool function)
udf_func *udf;
if (function && using_udf_functions && (udf=find_udf((char*) tok, len)))
{
+ lex->thd->safe_to_cache_query=0;
+ lex->yylval->udf=udf;
switch (udf->returns) {
case STRING_RESULT:
- lex->yylval->udf=udf;
return (udf->type == UDFTYPE_FUNCTION) ? UDF_CHAR_FUNC : UDA_CHAR_SUM;
case REAL_RESULT:
- lex->yylval->udf=udf;
return (udf->type == UDFTYPE_FUNCTION) ? UDF_FLOAT_FUNC : UDA_FLOAT_SUM;
case INT_RESULT:
- lex->yylval->udf=udf;
return (udf->type == UDFTYPE_FUNCTION) ? UDF_INT_FUNC : UDA_INT_SUM;
}
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index dba8216e94c..46a1b8506f0 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -300,7 +300,7 @@ typedef struct st_lex
char *backup_dir; /* For RESTORE/BACKUP */
char* to_log; /* For PURGE MASTER LOGS TO */
char* x509_subject,*x509_issuer,*ssl_cipher;
- enum SSL_type ssl_type; /* defined in violite.h */
+ enum SSL_type ssl_type; /* defined in violite.h */
String *wild;
sql_exchange *exchange;
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index fe556be98f5..52d1f3adf48 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -248,8 +248,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->next_number_field=table->found_next_number_field;
VOID(table->file->extra_opt(HA_EXTRA_WRITE_CACHE,
thd->variables.read_buff_size));
- VOID(table->file->extra_opt(HA_EXTRA_BULK_INSERT_BEGIN,
- thd->variables.bulk_insert_buff_size));
+ table->bulk_insert= 1;
if (handle_duplicates == DUP_IGNORE ||
handle_duplicates == DUP_REPLACE)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 461276900a5..d00f340c8d6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -79,10 +79,6 @@ const char *command_name[]={
static char empty_c_string[1]= {0}; // Used for not defined 'db'
-#ifdef HAVE_OPENSSL
-extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
-#endif /* HAVE_OPENSSL */
-
#ifdef __WIN__
static void test_signal(int sig_ptr)
{
@@ -329,6 +325,38 @@ void free_max_user_conn(void)
/*
+ Mark all commands that somehow changes a table
+ This is used to check number of updates / hour
+*/
+
+char uc_update_queries[SQLCOM_END];
+
+void init_update_queries(void)
+{
+ uc_update_queries[SQLCOM_CREATE_TABLE]=1;
+ uc_update_queries[SQLCOM_CREATE_INDEX]=1;
+ uc_update_queries[SQLCOM_ALTER_TABLE]=1;
+ uc_update_queries[SQLCOM_UPDATE]=1;
+ uc_update_queries[SQLCOM_INSERT]=1;
+ uc_update_queries[SQLCOM_INSERT_SELECT]=1;
+ uc_update_queries[SQLCOM_DELETE]=1;
+ uc_update_queries[SQLCOM_TRUNCATE]=1;
+ uc_update_queries[SQLCOM_DROP_TABLE]=1;
+ uc_update_queries[SQLCOM_LOAD]=1;
+ uc_update_queries[SQLCOM_CREATE_DB]=1;
+ uc_update_queries[SQLCOM_DROP_DB]=1;
+ uc_update_queries[SQLCOM_REPLACE]=1;
+ uc_update_queries[SQLCOM_REPLACE_SELECT]=1;
+ uc_update_queries[SQLCOM_RENAME_TABLE]=1;
+ uc_update_queries[SQLCOM_BACKUP_TABLE]=1;
+ uc_update_queries[SQLCOM_RESTORE_TABLE]=1;
+ uc_update_queries[SQLCOM_DELETE_MULTI]=1;
+ uc_update_queries[SQLCOM_DROP_INDEX]=1;
+ uc_update_queries[SQLCOM_MULTI_UPDATE]=1;
+}
+
+
+/*
Check if maximum queries per hour limit has been reached
returns 0 if OK.
@@ -337,7 +365,6 @@ void free_max_user_conn(void)
a couple of queries, this isn't critical.
*/
-char uc_update_queries[SQLCOM_END];
static bool check_mqh(THD *thd, uint check_command)
{
@@ -619,9 +646,6 @@ pthread_handler_decl(handle_one_connection,arg)
{
int error;
NET *net= &thd->net;
-
- thd->mysys_var=my_thread_var;
- thd->dbug_thread_id=my_thread_id();
thd->thread_stack= (char*) &thd;
if ((error=check_connections(thd)))
@@ -704,8 +728,6 @@ pthread_handler_decl(handle_bootstrap,arg)
pthread_detach_this_thread();
thd->thread_stack= (char*) &thd;
- thd->mysys_var=my_thread_var;
- thd->dbug_thread_id=my_thread_id();
#if !defined(__WIN__) && !defined(OS2)
sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use
@@ -781,7 +803,7 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
if (!(table_list = (TABLE_LIST*) thd->calloc(sizeof(TABLE_LIST))))
DBUG_RETURN(1); // out of memory
table_list->db = db;
- table_list->real_name = table_list->name = tbl_name;
+ table_list->real_name = table_list->alias = tbl_name;
table_list->lock_type = TL_READ_NO_INSERT;
table_list->next = 0;
remove_escape(table_list->real_name);
@@ -992,7 +1014,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
thd->free_list=0;
- table_list.name=table_list.real_name=thd->strdup(packet);
+ table_list.alias= table_list.real_name= thd->strdup(packet);
packet=strend(packet)+1;
// command not cachable => no gap for data base name
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
@@ -1437,7 +1459,12 @@ mysql_execute_command(THD *thd)
{
if (check_global_access(thd, REPL_SLAVE_ACL))
goto error;
+#ifndef WORKING_NEW_MASTER
+ net_printf(&thd->net, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER");
+ res= 1;
+#else
res = show_new_master(thd);
+#endif
break;
}
case SQLCOM_SHOW_SLAVE_HOSTS:
@@ -1534,9 +1561,9 @@ mysql_execute_command(THD *thd)
if (error)
goto error;
}
- if (strlen(tables->name) > NAME_LEN)
+ if (strlen(tables->real_name) > NAME_LEN)
{
- net_printf(thd,ER_WRONG_TABLE_NAME,tables->name);
+ net_printf(thd,ER_WRONG_TABLE_NAME,tables->real_name);
break;
}
LOCK_ACTIVE_MI;
@@ -1570,9 +1597,9 @@ mysql_execute_command(THD *thd)
if (error)
goto error;
}
- if (strlen(tables->name) > NAME_LEN)
+ if (strlen(tables->real_name) > NAME_LEN)
{
- net_printf(thd,ER_WRONG_TABLE_NAME,tables->name);
+ net_printf(thd, ER_WRONG_TABLE_NAME, tables->alias);
res=0;
break;
}
@@ -1581,9 +1608,9 @@ mysql_execute_command(THD *thd)
#else
/* Fix names if symlinked tables */
if (append_file_to_dir(thd, &lex->create_info.data_file_name,
- tables->name) ||
+ tables->real_name) ||
append_file_to_dir(thd,&lex->create_info.index_file_name,
- tables->name))
+ tables->real_name))
{
res=-1;
break;
@@ -1930,10 +1957,10 @@ mysql_execute_command(THD *thd)
lex->lock_option);
break;
case SQLCOM_REPLACE:
- if (check_access(thd,INSERT_ACL | UPDATE_ACL | DELETE_ACL,
+ if (check_access(thd,INSERT_ACL | DELETE_ACL,
tables->db,&tables->grant.privilege))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,INSERT_ACL | UPDATE_ACL | DELETE_ACL,
+ if (grant_option && check_grant(thd,INSERT_ACL | DELETE_ACL,
tables))
goto error;
@@ -1951,7 +1978,7 @@ mysql_execute_command(THD *thd)
*/
{
ulong privilege= (lex->sql_command == SQLCOM_INSERT_SELECT ?
- INSERT_ACL : INSERT_ACL | UPDATE_ACL | DELETE_ACL);
+ INSERT_ACL : INSERT_ACL | DELETE_ACL);
TABLE_LIST *save_next=tables->next;
tables->next=0;
if (check_access(thd, privilege,
@@ -2016,14 +2043,10 @@ mysql_execute_command(THD *thd)
goto error;
// Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
- /* TRUNCATE ends previous transaction */
- if (lex->sql_command == SQLCOM_TRUNCATE && end_active_trans(thd))
- res= -1;
- else
- res = mysql_delete(thd,tables, select_lex->where,
- (ORDER*) select_lex->order_list.first,
- select_lex->select_limit, lex->lock_option,
- select_lex->options);
+ res = mysql_delete(thd,tables, select_lex->where,
+ (ORDER*) select_lex->order_list.first,
+ select_lex->select_limit, lex->lock_option,
+ select_lex->options);
break;
}
case SQLCOM_DELETE_MULTI:
@@ -2209,7 +2232,7 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
}
remove_escape(db); // Fix escaped '_'
- remove_escape(tables->name);
+ remove_escape(tables->real_name);
if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,&thd->col_access))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
@@ -2234,7 +2257,7 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
}
remove_escape(db); // Fix escaped '_'
- remove_escape(tables->name);
+ remove_escape(tables->real_name);
if (!tables->db)
tables->db=thd->db;
if (check_access(thd,SELECT_ACL,db,&thd->col_access))
@@ -2276,9 +2299,7 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_SET_OPTION:
- if (sql_set_variables(thd, &lex->var_list))
- res= -1;
- else
+ if (!(res=sql_set_variables(thd, &lex->var_list)))
send_ok(thd);
break;
case SQLCOM_UNLOCK_TABLES:
@@ -3376,7 +3397,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
ptr->db_length= 0;
}
- ptr->name=alias_str;
+ ptr->alias= alias_str;
if (lower_case_table_names)
{
my_casedn_str(system_charset_info,ptr->db);
@@ -3401,7 +3422,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
tables ;
tables=tables->next)
{
- if (!strcmp(alias_str,tables->name) && !strcmp(ptr->db, tables->db))
+ if (!strcmp(alias_str,tables->alias) && !strcmp(ptr->db, tables->db))
{
net_printf(thd,ER_NONUNIQ_TABLE,alias_str); /* purecov: tested */
DBUG_RETURN(0); /* purecov: tested */
@@ -3447,7 +3468,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
select_errors=0; /* Write if more errors */
if (options & REFRESH_GRANT)
{
- acl_reload();
+ acl_reload(thd);
grant_reload();
if (mqh_used)
reset_mqh(thd,(LEX_USER *) NULL,true);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 03b840aebf9..32b7c3be025 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -911,6 +911,11 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2)
{
int res;
+ /*
+ TODO: Change compare function to work with file name of type
+ '.999 and .1000'
+ */
+
if ((res = strcmp(log_file_name1, log_file_name2)))
return res;
if (log_pos1 > log_pos2)
@@ -920,6 +925,7 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
return -1;
}
+
int show_binlog_events(THD* thd)
{
DBUG_ENTER("show_binlog_events");
@@ -1011,15 +1017,16 @@ err:
if (errmsg)
{
- net_printf(thd, ER_ERROR_WHEN_EXECUTING_COMMAND,
- "SHOW BINLOG EVENTS", errmsg);
- DBUG_RETURN(1);
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
+ "SHOW BINLOG EVENTS", errmsg);
+ DBUG_RETURN(-1);
}
send_eof(thd);
DBUG_RETURN(0);
}
+
int show_binlog_info(THD* thd)
{
DBUG_ENTER("show_binlog_info");
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 1d919df7309..197fd03ec7c 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -12,8 +12,7 @@ typedef struct st_slave_info
} SLAVE_INFO;
extern my_bool opt_show_slave_auth_info, opt_old_rpl_compat;
-extern char* master_host;
-extern my_string opt_bin_logname, master_info_file;
+extern char *master_host, *master_info_file;
extern bool server_id_supplied;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2b737ab65d7..1b0e8ff70db 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -713,8 +713,7 @@ JOIN::exec()
(const_tables == tables ||
(simple_order &&
test_if_skip_sort_order(&join_tab[const_tables], order,
- (const_tables != tables - 1 ||
- (select_options & OPTION_FOUND_ROWS)) ?
+ (select_options & OPTION_FOUND_ROWS) ?
HA_POS_ERROR : unit->select_limit_cnt,
0))))
order=0;
@@ -734,7 +733,7 @@ JOIN::exec()
DBUG_PRINT("info",("Creating tmp table"));
thd->proc_info="Creating tmp table";
- tmp_table_param.hidden_field_count= (all_fields.elements-
+ tmp_table_param.hidden_field_count= (all_fields.elements -
fields_list.elements);
if (!(exec_tmp_table =
create_tmp_table(thd, &tmp_table_param, all_fields,
@@ -974,7 +973,6 @@ JOIN::exec()
if (create_sort_index(&join_tab[const_tables],
group_list ? group_list : order,
(having_list || group_list ||
- const_tables != tables - 1 ||
(select_options & OPTION_FOUND_ROWS)) ?
HA_POS_ERROR : unit->select_limit_cnt))
DBUG_VOID_RETURN;
@@ -2174,7 +2172,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
join->positions[idx].key=best_key;
join->positions[idx].table= s;
if (!best_key && idx == join->const_tables &&
- s->table == join->sort_by_table)
+ s->table == join->sort_by_table &&
+ join->thd->select_limit >= records)
join->sort_by_table= (TABLE*) 1; // Must use temporary table
/*
@@ -3778,8 +3777,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->using_indirect_summary_function=1;
continue;
}
- if (item->const_item()) // We don't have to store this
- continue;
+ if (item->const_item() && (int) hidden_field_count <= 0)
+ continue; // We don't have to store this
}
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
{ /* Can't calc group yet */
@@ -3834,6 +3833,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
if (!--hidden_field_count)
hidden_null_count=null_count;
}
+ DBUG_ASSERT(field_count >= (uint) (reg_field - table->field));
field_count= (uint) (reg_field - table->field);
/* If result table is small; use a heap */
@@ -5741,8 +5741,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
Use a traversal function that starts by reading the last row
with key part (A) and then traverse the index backwards.
*/
- if (table->file->table_flags() & HA_NOT_READ_PREFIX_LAST)
- DBUG_RETURN(1);
+ if (table->file->index_flags(ref_key) & HA_NOT_READ_PREFIX_LAST)
+ DBUG_RETURN(0); // Use filesort
tab->read_first_record= join_read_last_key;
tab->read_record.read_record= join_read_prev_same;
/* fall through */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 0682123a89e..827067c27d7 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -527,7 +527,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
packet->length(0);
net_store_data(packet,convert, file_name);
table_list.db=(char*) db;
- table_list.real_name=table_list.name=file_name;
+ table_list.real_name= table_list.alias= file_name;
if (!(table = open_ltable(thd, &table_list, TL_READ)))
{
for (uint i=0 ; i < field_list.elements ; i++)
@@ -542,10 +542,10 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);
net_store_data(packet, convert, file->table_type());
net_store_data(packet, convert,
+ (table->db_options_in_use & HA_OPTION_COMPRESS_RECORD) ?
+ "Compressed" :
(table->db_options_in_use & HA_OPTION_PACK_RECORD) ?
- "Dynamic" :
- (table->db_options_in_use & HA_OPTION_COMPRESS_RECORD)
- ? "Compressed" : "Fixed");
+ "Dynamic" : "Fixed");
net_store_data(packet, (longlong) file->records);
net_store_data(packet, (uint32) file->mean_rec_length);
net_store_data(packet, (longlong) file->data_file_length);
@@ -645,7 +645,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
/***************************************************************************
- List all columns in a table
+** List all columns in a table_list->real_name
***************************************************************************/
int
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index fb0815a1a26..a71f555cdd7 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -18,6 +18,9 @@
/* drop and alter of tables */
#include "mysql_priv.h"
+#ifdef HAVE_BERKELEY_DB
+#include "ha_berkeley.h"
+#endif
#include <hash.h>
#include <myisam.h>
#include <assert.h>
@@ -257,10 +260,32 @@ static int sort_keys(KEY *a, KEY *b)
}
-/*****************************************************************************
- * Create a table.
- * If one creates a temporary table, this is automaticly opened
- ****************************************************************************/
+/*
+ Create a table
+
+ SYNOPSIS
+ mysql_create_table()
+ thd Thread object
+ db Database
+ table_name Table name
+ create_info Create information (like MAX_ROWS)
+ fields List of fields to create
+ keys List of keys to create
+ tmp_table Set to 1 if this is a temporary table
+ no_log Don't log the query to binary log.
+
+ DESCRIPTION
+ If one creates a temporary table, this is automaticly opened
+
+ no_log is needed for the case of CREATE ... SELECT,
+ as the logging will be done later in sql_insert.cc
+ select_field_count is also used for CREATE ... SELECT,
+ and must be zero for standard create of table.
+
+ RETURN VALUES
+ 0 ok
+ -1 error
+*/
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
@@ -698,7 +723,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
- uint max_key_length= max(file->max_key_length(), MAX_KEY_LENGTH);
+ uint max_key_length= min(file->max_key_length(), MAX_KEY_LENGTH);
if (key_length > max_key_length && key->type != Key::FULLTEXT)
{
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
@@ -938,7 +963,7 @@ bool close_cached_table(THD *thd,TABLE *table)
if (table)
{
- DBUG_PRINT("enter",("table: %s", table->table_name));
+ DBUG_PRINT("enter",("table: %s", table->real_name));
VOID(table->file->extra(HA_EXTRA_FORCE_REOPEN)); // Close all data files
/* Mark all tables that are in use as 'old' */
mysql_lock_abort(thd,table); // end threads waiting on lock
@@ -946,7 +971,7 @@ bool close_cached_table(THD *thd,TABLE *table)
#if defined(USING_TRANSACTIONS) || defined( __WIN__) || defined( __EMX__) || !defined(OS2)
/* Wait until all there are no other threads that has this table open */
while (remove_table_from_cache(thd,table->table_cache_key,
- table->table_name))
+ table->real_name))
{
dropping_tables++;
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
@@ -954,7 +979,7 @@ bool close_cached_table(THD *thd,TABLE *table)
}
#else
(void) remove_table_from_cache(thd,table->table_cache_key,
- table->table_name);
+ table->real_name);
#endif
/* When lock on LOCK_open is freed other threads can continue */
pthread_cond_broadcast(&COND_refresh);
@@ -977,7 +1002,7 @@ static int send_check_errmsg(THD* thd, TABLE_LIST* table,
String* packet = &thd->packet;
packet->length(0);
- net_store_data(packet, table->name);
+ net_store_data(packet, table->alias);
net_store_data(packet, (char*)operator_name);
net_store_data(packet, "error");
net_store_data(packet, errmsg);
@@ -1004,7 +1029,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table,
{
char* backup_dir = thd->lex.backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char* table_name = table->name;
+ char* table_name = table->real_name;
char* db = thd->db ? thd->db : table->db;
if (fn_format_relative_to_data_home(src_path, table_name, backup_dir,
@@ -1065,11 +1090,13 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
char from[FN_REFLEN],tmp[FN_REFLEN];
char* db = thd->db ? thd->db : table->db;
- sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->name);
+ sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->real_name);
fn_format(from, from, "", MI_NAME_DEXT, 4);
sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id);
+ pthread_mutex_lock(&LOCK_open);
close_cached_table(thd,table->table);
+ pthread_mutex_unlock(&LOCK_open);
if (lock_and_wait_for_table_name(thd,table))
DBUG_RETURN(-1);
@@ -1147,7 +1174,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
char table_name[NAME_LEN*2+2];
char* db = (table->db) ? table->db : thd->db;
bool fatal_error=0;
- strxmov(table_name,db ? db : "",".",table->name,NullS);
+ strxmov(table_name,db ? db : "",".",table->real_name,NullS);
thd->open_options|= extra_open_options;
table->table = open_ltable(thd, table, lock_type);
@@ -1979,11 +2006,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID(pthread_cond_broadcast(&COND_refresh));
goto err;
}
-#ifdef HAVE_BERKELEY_DB
- extern bool berkeley_flush_logs(void);
- if (old_db_type == DB_TYPE_BERKELEY_DB && berkeley_flush_logs())
- goto err;
-#endif
thd->proc_info="end";
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
@@ -1993,6 +2015,21 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
VOID(pthread_cond_broadcast(&COND_refresh));
VOID(pthread_mutex_unlock(&LOCK_open));
+#ifdef HAVE_BERKELEY_DB
+ if (old_db_type == DB_TYPE_BERKELEY_DB)
+ {
+ (void) berkeley_flush_logs();
+ /*
+ For the alter table to be properly flushed to the logs, we
+ have to open the new table. If not, we get a problem on server
+ shutdown.
+ */
+ if (!open_tables(thd, table_list)) // Should always succeed
+ {
+ close_thread_table(thd, &table_list->table);
+ }
+ }
+#endif
table_list->table=0; // For query cache
query_cache_invalidate3(thd, table_list, 0);
@@ -2056,7 +2093,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
MYF(MY_FAE | MY_ZEROFILL));
bzero((char*) &tables,sizeof(tables));
tables.table = from;
- tables.name = tables.real_name= from->real_name;
+ tables.alias = tables.real_name= from->real_name;
tables.db = from->table_cache_key;
error=1;
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 893f0838a7f..f45eca0b65f 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -133,18 +133,16 @@ void udf_init()
sql_print_error("Can't allocate memory for udf structures");
hash_free(&udf_hash);
free_root(&mem,MYF(0));
+ delete new_thd;
DBUG_VOID_RETURN;
}
initialized = 1;
- new_thd->mysys_var=my_thread_var;
- new_thd->version = refresh_version; //current_thd->version;
- new_thd->current_tablenr = 0;
- new_thd->open_tables = 0;
+ new_thd->store_globals();
new_thd->db= my_strdup("mysql", MYF(0));
new_thd->db_length=5;
bzero((gptr) &tables,sizeof(tables));
- tables.name = tables.real_name = (char*) "func";
+ tables.alias= tables.real_name= (char*) "func";
tables.lock_type = TL_READ;
tables.db=new_thd->db;
@@ -181,9 +179,10 @@ void udf_init()
{
if (!(dl = dlopen(tmp->dl, RTLD_NOW)))
{
+ /* Print warning to log */
sql_print_error(ER(ER_CANT_OPEN_LIBRARY),
tmp->dl,errno,dlerror());
- del_udf(tmp);
+ /* Keep the udf in the hash so that we can remove it later */
continue;
}
new_dl=1;
@@ -215,16 +214,17 @@ void udf_free()
for (uint idx=0 ; idx < udf_hash.records ; idx++)
{
udf_func *udf=(udf_func*) hash_element(&udf_hash,idx);
- if (udf->dl)
+ if (udf->dlhandle) // Not closed before
{
+ /* Mark all versions using the same handler as closed */
for (uint j=idx+1 ; j < udf_hash.records ; j++)
{
udf_func *tmp=(udf_func*) hash_element(&udf_hash,j);
- if (tmp->dl && !strcmp(udf->dl,tmp->dl))
- tmp->dl=0;
+ if (udf->dlhandle == tmp->dlhandle)
+ tmp->dlhandle=0; // Already closed
}
+ dlclose(udf->dlhandle);
}
- dlclose(udf->dlhandle);
}
hash_free(&udf_hash);
free_root(&mem,MYF(0));
@@ -243,9 +243,9 @@ static void del_udf(udf_func *udf)
else
{
/*
- ** The functions is in use ; Rename the functions instead of removing it.
- ** The functions will be automaticly removed when the least threads
- ** doesn't use it anymore
+ The functions is in use ; Rename the functions instead of removing it.
+ The functions will be automaticly removed when the least threads
+ doesn't use it anymore
*/
char *name= udf->name;
uint name_length=udf->name_length;
@@ -263,6 +263,10 @@ void free_udf(udf_func *udf)
pthread_mutex_lock(&THR_LOCK_udf);
if (!--udf->usage_count)
{
+ /*
+ We come here when someone has deleted the udf function
+ while another thread still was using the udf
+ */
hash_delete(&udf_hash,(byte*) udf);
using_udf_functions=udf_hash.records != 0;
if (!find_udf_dl(udf->dl))
@@ -272,6 +276,7 @@ void free_udf(udf_func *udf)
DBUG_VOID_RETURN;
}
+
/* This is only called if using_udf_functions != 0 */
udf_func *find_udf(const char *name,uint length,bool mark_used)
@@ -281,20 +286,26 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
/* TODO: This should be changed to reader locks someday! */
pthread_mutex_lock(&THR_LOCK_udf);
- udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
- length ? length : (uint) strlen(name));
- if (mark_used)
- udf->usage_count++;
+ if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
+ length ? length : (uint) strlen(name))))
+ {
+ if (!udf->dlhandle)
+ udf=0; // Could not be opened
+ else if (mark_used)
+ udf->usage_count++;
+ }
pthread_mutex_unlock(&THR_LOCK_udf);
DBUG_RETURN(udf);
}
+
static void *find_udf_dl(const char *dl)
{
DBUG_ENTER("find_udf_dl");
- /* because only the function name is hashed, we have to search trough
- ** all rows to find the dl.
+ /*
+ Because only the function name is hashed, we have to search trough
+ all rows to find the dl.
*/
for (uint idx=0 ; idx < udf_hash.records ; idx++)
{
@@ -311,7 +322,7 @@ static void *find_udf_dl(const char *dl)
static udf_func *add_udf(char *name, Item_result ret, char *dl,
Item_udftype type)
{
- if (!name || !dl)
+ if (!name || !dl || !(uint) type || (uint) type > (uint) UDFTYPE_AGGREGATE)
return 0;
udf_func *tmp= (udf_func*) alloc_root(&mem, sizeof(udf_func));
if (!tmp)
@@ -363,7 +374,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
}
pthread_mutex_lock(&THR_LOCK_udf);
- if (hash_search(&udf_hash,(byte*) udf->name, udf->name_length))
+ if ((hash_search(&udf_hash,(byte*) udf->name, udf->name_length)))
{
net_printf(thd, ER_UDF_EXISTS, udf->name);
goto err;
@@ -389,8 +400,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
}
udf->name=strdup_root(&mem,udf->name);
udf->dl=strdup_root(&mem,udf->dl);
- if (!udf->name || !udf->dl ||
- !(u_d=add_udf(udf->name,udf->returns,udf->dl,udf->type)))
+ if (!(u_d=add_udf(udf->name,udf->returns,udf->dl,udf->type)))
{
send_error(thd,0); // End of memory
goto err;
@@ -406,7 +416,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
bzero((char*) &tables,sizeof(tables));
tables.db= (char*) "mysql";
- tables.real_name=tables.name= (char*) "func";
+ tables.real_name= tables.alias= (char*) "func";
/* Allow creation of functions even if we can't open func table */
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
goto err;
@@ -449,18 +459,23 @@ int mysql_drop_function(THD *thd,const char *udf_name)
DBUG_RETURN(1);
}
pthread_mutex_lock(&THR_LOCK_udf);
- if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name, (uint) strlen(udf_name))))
+ if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name,
+ (uint) strlen(udf_name))))
{
net_printf(thd, ER_FUNCTION_NOT_DEFINED, udf_name);
goto err;
}
del_udf(udf);
- if (!find_udf_dl(udf->dl))
+ /*
+ Close the handle if this was function that was found during boot or
+ CREATE FUNCTION and it's not in use by any other udf function
+ */
+ if (udf->dlhandle && !find_udf_dl(udf->dl))
dlclose(udf->dlhandle);
bzero((char*) &tables,sizeof(tables));
tables.db=(char*) "mysql";
- tables.real_name=tables.name=(char*) "func";
+ tables.real_name= tables.alias= (char*) "func";
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
goto err;
if (!table->file->index_read_idx(table->record[0],0,(byte*) udf_name,
@@ -481,10 +496,3 @@ int mysql_drop_function(THD *thd,const char *udf_name)
}
#endif /* HAVE_DLOPEN */
-
-/*
-** Local variables:
-** tab-width: 8
-** c-basic-offset: 2
-** End:
-*/
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 8244384cc94..60563801d68 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -94,7 +94,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
bzero((char*) &result_table_list,sizeof(result_table_list));
result_table_list.db= (char*) "";
- result_table_list.real_name=result_table_list.name=(char*) "union";
+ result_table_list.real_name=result_table_list.alias= (char*) "union";
result_table_list.table=table;
if (!(union_result=new select_union(table)))
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index cc06344304f..1b50cb03572 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -129,6 +129,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MASTER_SYM
%token MAX_SYM
%token MIN_SYM
+%token NONE_SYM
%token OPTIMIZE
%token PURGE
%token REPAIR
@@ -630,7 +631,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_to_table_list table_to_table opt_table_list opt_as
handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild union union_list
- precision union_option opt_on_delete_item subselect_start
+ precision union_option opt_on_delete_item subselect_start opt_and
subselect_end
END_OF_INPUT
@@ -2039,7 +2040,6 @@ simple_expr:
$$ = new Item_sum_udf_str($1, *$3);
else
$$ = new Item_sum_udf_str($1);
- current_thd->safe_to_cache_query=0;
}
| UDA_FLOAT_SUM '(' udf_expr_list ')'
{
@@ -2047,7 +2047,6 @@ simple_expr:
$$ = new Item_sum_udf_float($1, *$3);
else
$$ = new Item_sum_udf_float($1);
- current_thd->safe_to_cache_query=0;
}
| UDA_INT_SUM '(' udf_expr_list ')'
{
@@ -2062,7 +2061,6 @@ simple_expr:
$$ = new Item_func_udf_str($1, *$3);
else
$$ = new Item_func_udf_str($1);
- current_thd->safe_to_cache_query=0;
}
| UDF_FLOAT_FUNC '(' udf_expr_list ')'
{
@@ -2070,7 +2068,6 @@ simple_expr:
$$ = new Item_func_udf_float($1, *$3);
else
$$ = new Item_func_udf_float($1);
- current_thd->safe_to_cache_query=0;
}
| UDF_INT_FUNC '(' udf_expr_list ')'
{
@@ -2078,7 +2075,6 @@ simple_expr:
$$ = new Item_func_udf_int($1, *$3);
else
$$ = new Item_func_udf_int($1);
- current_thd->safe_to_cache_query=0;
}
| UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')'
{
@@ -2220,8 +2216,8 @@ join_table_list:
| join_table_list INNER_SYM JOIN_SYM join_table
{
SELECT_LEX *sel=Select;
- sel->db1=$1->db; sel->table1=$1->name;
- sel->db2=$4->db; sel->table2=$4->name;
+ sel->db1=$1->db; sel->table1=$1->alias;
+ sel->db2=$4->db; sel->table2=$4->alias;
}
USING '(' using_list ')'
{ add_join_on($4,$8); $$=$4; }
@@ -2230,8 +2226,8 @@ join_table_list:
| join_table_list LEFT opt_outer JOIN_SYM join_table
{
SELECT_LEX *sel=Select;
- sel->db1=$1->db; sel->table1=$1->name;
- sel->db2=$5->db; sel->table2=$5->name;
+ sel->db1=$1->db; sel->table1=$1->alias;
+ sel->db2=$5->db; sel->table2=$5->alias;
}
USING '(' using_list ')'
{ add_join_on($5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
@@ -2242,8 +2238,8 @@ join_table_list:
| join_table_list RIGHT opt_outer JOIN_SYM join_table
{
SELECT_LEX *sel=Select;
- sel->db1=$1->db; sel->table1=$1->name;
- sel->db2=$5->db; sel->table2=$5->name;
+ sel->db1=$1->db; sel->table1=$1->alias;
+ sel->db2=$5->db; sel->table2=$5->alias;
}
USING '(' using_list ')'
{ add_join_on($1,$9); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; }
@@ -3421,6 +3417,7 @@ keyword:
| NEXT_SYM {}
| NEW_SYM {}
| NO_SYM {}
+ | NONE_SYM {}
| OPEN_SYM {}
| PACK_KEYS_SYM {}
| PARTIAL {}
@@ -3543,7 +3540,7 @@ option_value:
LEX *lex=Lex;
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("tx_isolation"),
- new Item_int((int) $4)));
+ new Item_int((int32) $4)));
}
| CHAR_SYM SET opt_equal set_expr_or_default
{
@@ -3706,6 +3703,8 @@ revoke:
lex->columns.empty();
lex->grant= lex->grant_tot_col=0;
lex->select->db=0;
+ lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
+ lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0;
bzero((char*) &lex->mqh, sizeof(lex->mqh));
}
grant_privileges ON opt_table FROM user_list;
@@ -3714,13 +3713,13 @@ grant:
GRANT
{
LEX *lex=Lex;
- lex->sql_command = SQLCOM_GRANT;
lex->users_list.empty();
lex->columns.empty();
- lex->grant= lex->grant_tot_col=0;
- lex->select->db=0;
- lex->ssl_type=SSL_TYPE_NONE;
- lex->ssl_cipher=lex->x509_subject=lex->x509_issuer=0;
+ lex->sql_command = SQLCOM_GRANT;
+ lex->grant= lex->grant_tot_col= 0;
+ lex->select->db= 0;
+ lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
+ lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0;
bzero(&(lex->mqh),sizeof(lex->mqh));
}
grant_privileges ON opt_table TO_SYM user_list
@@ -3760,10 +3759,19 @@ grant_privilege:
| REPLICATION CLIENT_SYM { Lex->grant |= REPL_CLIENT_ACL;}
;
-require_list: require_list_element AND require_list
-| require_list_element ;
-require_list_element: SUBJECT_SYM TEXT_STRING
+opt_and:
+ /* empty */ {}
+ | AND {}
+ ;
+
+require_list:
+ require_list_element opt_and require_list
+ | require_list_element
+ ;
+
+require_list_element:
+ SUBJECT_SYM TEXT_STRING
{
LEX *lex=Lex;
if (lex->x509_subject)
@@ -3908,17 +3916,21 @@ column_list_id:
require_clause: /* empty */
| REQUIRE_SYM require_list
- {
- Lex->ssl_type=SSL_TYPE_SPECIFIED;
- }
+ {
+ Lex->ssl_type=SSL_TYPE_SPECIFIED;
+ }
| REQUIRE_SYM SSL_SYM
- {
- Lex->ssl_type=SSL_TYPE_ANY;
- }
+ {
+ Lex->ssl_type=SSL_TYPE_ANY;
+ }
| REQUIRE_SYM X509_SYM
- {
- Lex->ssl_type=SSL_TYPE_X509;
- };
+ {
+ Lex->ssl_type=SSL_TYPE_X509;
+ }
+ | REQUIRE_SYM NONE_SYM
+ {
+ Lex->ssl_type=SSL_TYPE_NONE;
+ }
grant_options:
/* empty */ {}
diff --git a/sql/table.h b/sql/table.h
index 02abb090426..b9ebeda160a 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -91,7 +91,7 @@ struct st_table {
my_bool null_row; /* All columns are null */
my_bool maybe_null,outer_join; /* Used with OUTER JOIN */
my_bool distinct,const_table,no_rows;
- my_bool key_read;
+ my_bool key_read, bulk_insert;
my_bool crypted;
my_bool db_low_byte_first; /* Portable row format */
my_bool locked_by_flush;
@@ -139,10 +139,9 @@ struct st_table {
typedef struct st_table_list
{
struct st_table_list *next;
- char *db,*name,*real_name;
- uint32 db_length, real_name_length;
- Item *on_expr; /* Used with outer join */
- struct st_table_list *natural_join; /* natural join on this table*/
+ char *db, *alias, *real_name;
+ Item *on_expr; /* Used with outer join */
+ struct st_table_list *natural_join; /* natural join on this table*/
/* ... join ... USE INDEX ... IGNORE INDEX */
List<String> *use_index, *ignore_index;
/*
@@ -154,14 +153,15 @@ typedef struct st_table_list
TABLE *table; /* opened table */
st_table_list *table_list; /* pointer to node of list of all tables */
};
- GRANT_INFO grant;
+ void *derived; /* SELECT_LEX_UNIT of derived table */
+ GRANT_INFO grant;
thr_lock_type lock_type;
uint outer_join; /* Which join type */
+ uint32 db_length, real_name_length;
bool straight; /* optimize with prev table */
bool updating; /* for replicate-do/ignore table */
bool shared; /* Used twice in union */
- bool do_redirect; /* If *table has to be fixed in UNION */
- void *derived; /* SELECT_LEX_UNIT of derived table */
+ bool do_redirect; /* To get the struct in UNION's */
} TABLE_LIST;
typedef struct st_changed_table_list
diff --git a/sql/time.cc b/sql/time.cc
index aadc32964ff..e7c9ee82f93 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -430,6 +430,7 @@ timestamp_type
str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
{
uint field_length,year_length,digits,i,number_of_fields,date[7];
+ uint not_zero_date;
const char *pos;
const char *end=str+length;
DBUG_ENTER("str_to_TIME");
@@ -448,6 +449,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
digits= (uint) (pos-str);
year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
field_length=year_length-1;
+ not_zero_date= 0;
for (i=0 ; i < 6 && str != end && my_isdigit(system_charset_info,*str) ; i++)
{
uint tmp_value=(uint) (uchar) (*str++ - '0');
@@ -457,6 +459,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
str++;
}
date[i]=tmp_value;
+ not_zero_date|= tmp_value;
if (i == 2 && str != end && *str == 'T')
str++; // ISO8601: CCYYMMDDThhmmss
else if ( i != 5 ) // Skip inter-field delimiters
@@ -483,6 +486,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
while (str++ != end && my_isdigit(system_charset_info,str[0]) && field_length--)
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
date[6]=tmp_value;
+ not_zero_date|= tmp_value;
}
else
date[6]=0;
@@ -496,7 +500,20 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
date[2] > 31 || date[3] > 23 || date[4] > 59 || date[5] > 59 ||
!fuzzy_date && (date[1] == 0 || date[2] == 0))
{
- current_thd->cuted_fields++;
+ /* Only give warning for a zero date if there is some garbage after */
+ if (!not_zero_date) // If zero date
+ {
+ for (; str != end ; str++)
+ {
+ if (!isspace(*str))
+ {
+ not_zero_date= 1; // Give warning
+ break;
+ }
+ }
+ }
+ if (not_zero_date)
+ current_thd->cuted_fields++;
DBUG_RETURN(TIMESTAMP_NONE);
}
if (str != end && current_thd->count_cuted_fields)
diff --git a/sql/udf_example.cc b/sql/udf_example.cc
index f5ff9fe67b5..176ddeb10a3 100644
--- a/sql/udf_example.cc
+++ b/sql/udf_example.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2002 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
@@ -61,7 +61,7 @@
** On the end is a couple of functions that converts hostnames to ip and
** vice versa.
**
-** A dynamicly loadable file should be compiled sharable
+** A dynamicly loadable file should be compiled shared.
** (something like: gcc -shared -o my_func.so myfunc.cc).
** You can easily get all switches right by doing:
** cd sql ; make udf_example.o
@@ -69,6 +69,8 @@
** the line and add -shared -o udf_example.so to the end of the compile line.
** The resulting library (udf_example.so) should be copied to some dir
** searched by ld. (/usr/lib ?)
+** If you are using gcc, then you should be able to create the udf_example.so
+** by simply doing 'make udf_example.so'.
**
** After the library is made one must notify mysqld about the new
** functions with the commands:
@@ -109,6 +111,13 @@
#ifdef STANDARD
#include <stdio.h>
#include <string.h>
+#ifdef __WIN__
+typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
+typedef __int64 longlong;
+#else
+typedef unsigned long long ulonglong;
+typedef long long longlong;
+#endif /*__WIN__*/
#else
#include <my_global.h>
#include <my_sys.h>
@@ -133,7 +142,7 @@ longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error);
my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
void sequence_deinit(UDF_INIT *initid);
-long long sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
+longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error);
my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
void avgcost_deinit( UDF_INIT* initid );
@@ -556,10 +565,10 @@ double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
/* This function returns the sum of all arguments */
-long long myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
+longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error)
{
- long long val = 0;
+ longlong val = 0;
for (uint i = 0; i < args->arg_count; i++)
{
if (args->args[i] == NULL)
@@ -569,10 +578,10 @@ long long myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
val += args->lengths[i];
break;
case INT_RESULT: // Add numbers
- val += *((long long*) args->args[i]);
+ val += *((longlong*) args->args[i]);
break;
- case REAL_RESULT: // Add numers as long long
- val += (long long) *((double*) args->args[i]);
+ case REAL_RESULT: // Add numers as longlong
+ val += (longlong) *((double*) args->args[i]);
break;
}
}
@@ -615,12 +624,12 @@ void sequence_deinit(UDF_INIT *initid)
free(initid->ptr);
}
-long long sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
+longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error)
{
ulonglong val=0;
if (args->arg_count)
- val= *((long long*) args->args[0]);
+ val= *((longlong*) args->args[0]);
return ++ *((longlong*) initid->ptr) + val;
}
@@ -741,10 +750,10 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
return 0;
}
sprintf(result,"%d.%d.%d.%d",
- (int) *((long long*) args->args[0]),
- (int) *((long long*) args->args[1]),
- (int) *((long long*) args->args[2]),
- (int) *((long long*) args->args[3]));
+ (int) *((longlong*) args->args[0]),
+ (int) *((longlong*) args->args[1]),
+ (int) *((longlong*) args->args[2]),
+ (int) *((longlong*) args->args[3]));
}
else
{ // string argument
@@ -793,9 +802,9 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
struct avgcost_data
{
- unsigned long long count;
- long long totalquantity;
- double totalprice;
+ ulonglong count;
+ longlong totalquantity;
+ double totalprice;
};
@@ -869,8 +878,8 @@ avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message )
if (args->args[0] && args->args[1])
{
struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
- long long quantity = *((long long*)args->args[0]);
- long long newquantity = data->totalquantity + quantity;
+ longlong quantity = *((longlong*)args->args[0]);
+ longlong newquantity = data->totalquantity + quantity;
double price = *((double*)args->args[1]);
data->count++;
diff --git a/sql/unireg.h b/sql/unireg.h
index fd1117a4708..724ff3f6197 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -49,7 +49,7 @@
#define MAX_SYS_VAR_LENGTH 32
#define MAX_KEY 32 /* Max used keys */
#define MAX_REF_PARTS 16 /* Max parts used as ref */
-#define MAX_KEY_LENGTH 500 /* max possible key */
+#define MAX_KEY_LENGTH 1024 /* max possible key */
#if SIZEOF_OFF_T > 4
#define MAX_REFLENGTH 8 /* Max length for record ref */
#else
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index e49bc3f37f0..dcff17dee03 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -122,6 +122,7 @@ Summary: MySQL - server with Berkeley DB, RAID and UDF support
Group: Applications/Databases
Provides: mysql-Max
Obsoletes: mysql-Max
+Requires: MySQL >= 4.0
%description Max
Optional MySQL server binary that supports additional features like
@@ -481,6 +482,11 @@ fi
%changelog
+* Wed Sep 25 2002 Lenz Grimmer <lenz@mysql.com>
+
+- MySQL-Max now requires MySQL >= 4.0 to avoid version mismatches
+ (mixing 3.23 and 4.0 packages)
+
* Fri Aug 09 2002 Lenz Grimmer <lenz@mysql.com>
- Turn off OpenSSL in MySQL-Max for now until it works properly again
@@ -513,7 +519,7 @@ fi
take care of this
- reorganized the file list: actually install man pages along
with the binaries of the respective subpackage
-- don't include libmysqld.a in the devel subpackage as well, if we
+- do not include libmysqld.a in the devel subpackage as well, if we
have a special "embedded" subpackage
- reworked the package descriptions
diff --git a/tests/grant.pl b/tests/grant.pl
index 6da4326d465..9212c610ac1 100644
--- a/tests/grant.pl
+++ b/tests/grant.pl
@@ -304,7 +304,7 @@ safe_query("revoke GRANT OPTION on $opt_database.test from $user",1);
#
safe_query("grant select(a) on $opt_database.test to $user");
-user_query("show columns from test");
+user_query("show full columns from test");
safe_query("grant insert (b), update (b) on $opt_database.test to $user");
user_query("select count(a) from test");
@@ -435,8 +435,9 @@ user_connect(0);
user_query("LOCK TABLES $opt_database.test3 READ");
user_query("UNLOCK TABLES");
safe_query("revoke SELECT,INSERT,UPDATE,DELETE on $opt_database.test3 from $user");
-user_connect(1);
+user_connect(0);
safe_query("revoke LOCK TABLES on *.* from $user");
+user_connect(1);
safe_query("drop table $opt_database.test3");
#
diff --git a/tests/grant.res b/tests/grant.res
index b54fec94514..3359f970225 100644
--- a/tests/grant.res
+++ b/tests/grant.res
@@ -27,11 +27,11 @@ show grants for grant_user@localhost
GRANT SELECT ON *.* TO 'grant_user'@'localhost'
insert into mysql.user (host,user) values ('error','grant_user')
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
+Error in execute: insert command denied to user: 'grant_user@localhost' for table 'user'
update mysql.user set host='error' WHERE user='grant_user'
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
+Error in execute: update command denied to user: 'grant_user@localhost' for table 'user'
create table grant_test.test (a int,b int)
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: create command denied to user: 'grant_user@localhost' for table 'test'
grant select on *.* to grant_user2@localhost
Error in execute: Access denied for user: 'grant_user@localhost' (Using password: NO)
revoke select on grant_test.test from grant_user@opt_host
@@ -99,28 +99,28 @@ select * from mysql.user where user = 'grant_user'
localhost grant_user N N N N N N N N N N N N N N N N N N N N N 0 0 0
select * from mysql.db where user = 'grant_user'
-localhost grant_test grant_user Y N N N N N N N N N
+localhost grant_test grant_user Y N N N N N N N N N N N
Connecting grant_user
select count(*) from grant_test.test
2
select * from mysql.user where user = 'grant_user'
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
+Error in execute: select command denied to user: 'grant_user@localhost' for table 'user'
insert into grant_test.test values (4,0)
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: insert command denied to user: 'grant_user@localhost' for table 'test'
update grant_test.test set a=1
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: update command denied to user: 'grant_user@localhost' for table 'test'
delete from grant_test.test
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: delete command denied to user: 'grant_user@localhost' for table 'test'
create table grant_test.test2 (a int)
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: create command denied to user: 'grant_user@localhost' for table 'test2'
ALTER TABLE grant_test.test add c int
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: alter command denied to user: 'grant_user@localhost' for table 'test'
CREATE INDEX dummy ON grant_test.test (a)
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: index command denied to user: 'grant_user@localhost' for table 'test'
drop table grant_test.test
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: drop command denied to user: 'grant_user@localhost' for table 'test'
grant ALL PRIVILEGES on grant_test.* to grant_user2@localhost
Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant ALL PRIVILEGES on grant_test.* to grant_user@localhost WITH GRANT OPTION
@@ -133,14 +133,14 @@ REVOKE ALL PRIVILEGES on grant_test.* from grant_user@localhost
REVOKE ALL PRIVILEGES on grant_test.* from grant_user@localhost
Connecting grant_user
insert into grant_test.test values (6,0)
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
+Error in execute: insert command denied to user: 'grant_user@localhost' for table 'test'
REVOKE GRANT OPTION on grant_test.* from grant_user@localhost
Connecting grant_user
Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant ALL PRIVILEGES on grant_test.* to grant_user@localhost
Connecting grant_user
select * from mysql.user where user = 'grant_user'
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
+Error in execute: select command denied to user: 'grant_user@localhost' for table 'user'
insert into grant_test.test values (7,0)
update grant_test.test set a=3 where a=2
delete from grant_test.test where a=3
@@ -152,7 +152,7 @@ show tables from grant_test
test
insert into mysql.user (host,user) values ('error','grant_user',0)
-Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
+Error in execute: insert command denied to user: 'grant_user@localhost' for table 'user'
revoke ALL PRIVILEGES on grant_test.* from grant_user@localhost
select * from mysql.user where user = 'grant_user'
localhost grant_user N N N N N N N N N N N N N N N N N N N N N 0 0 0
@@ -190,11 +190,11 @@ delete from grant_test.test
Error in execute: delete command denied to user: 'grant_user@localhost' for table 'test'
grant delete on grant_test.test to grant_user@localhost
delete from grant_test.test where a=1
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
update grant_test.test set b=3 where b=1
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
update grant_test.test set b=b+1
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
select * from test
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
grant select on grant_test.test to grant_user@localhost
@@ -267,7 +267,7 @@ Error in execute: Access denied for user: 'grant_user@localhost' to database 'gr
drop database grant_test
Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
flush tables
-Error in execute: Access denied for user: 'grant_user@localhost' (Using password: NO)
+Error in execute: Access denied. You need the RELOAD privilege for this operation
flush privileges
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
localhost grant_test grant_user test2 root@localhost Update,Delete,Create,Grant,Index,Alter Insert
@@ -291,15 +291,15 @@ grant update(b),delete on grant_test.test to grant_user@localhost
revoke update(a) on grant_test.test from grant_user@localhost
Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test'
delete from grant_test.test where a=2
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
update test set b=5 where b>0
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
grant select(a),select(b) on grant_test.test to grant_user@localhost
delete from grant_test.test where a=2
delete from grant_test.test where A=2
update test set b=5 where b>0
update test set a=11 where b>5
-Error in execute: update command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
+Error in execute: UPDATE command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
select a,A from test
8 8
5 5
@@ -313,9 +313,9 @@ select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.t
revoke GRANT OPTION on grant_test.test from grant_user@localhost
Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test'
grant select(a) on grant_test.test to grant_user@localhost
-show columns from test
-a int(11) YES NULL
-b int(11) YES NULL
+show full columns from test
+a int(11) YES NULL select
+b int(11) YES NULL
grant insert (b), update (b) on grant_test.test to grant_user@localhost
select count(a) from test
@@ -333,19 +333,19 @@ update test set b=3 where a > 0
select * from test
Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
select b from test
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
select a from test where b > 0
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
insert into test (a) values (10)
-Error in execute: insert command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
+Error in execute: INSERT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
insert into test (b) values (b)
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
insert into test (a,b) values (1,5)
-Error in execute: insert command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
+Error in execute: INSERT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
insert into test (b) values (1),(b)
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
update test set b=3 where b > 0
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
localhost grant_test grant_user test root@localhost Select,Insert,Update
@@ -379,13 +379,13 @@ localhost grant_test grant_user test b Select,Insert,Update
localhost grant_test grant_user test a Select,Update
insert into test (a,b) values (12,12)
-Error in execute: insert command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
+Error in execute: INSERT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
grant insert on grant_test.* to grant_user@localhost
Connecting grant_user
insert into test (a,b) values (13,13)
revoke select(b) on grant_test.test from grant_user@localhost
select count(a) from test where a+b > 0
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
update test set b=5 where a=2
grant select on grant_test.test to grant_user@localhost
Connecting grant_user
@@ -402,7 +402,7 @@ select count(a) from test where a+b > 0
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
grant select(a) on grant_test.test to grant_user@localhost
select count(a) from test where a+b > 0
-Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
+Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
grant select on *.* to grant_user@localhost
Connecting grant_user
select count(a) from test where a+b > 0
@@ -415,7 +415,7 @@ select count(a) from test where a+b > 0
4
select * from mysql.db where user = 'grant_user'
-localhost grant_test grant_user N Y N N N N N N N N
+localhost grant_test grant_user N Y N N N N N N N N N N
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv where user = 'grant_user'
localhost grant_test grant_user test root@localhost Select,Insert,Update
@@ -430,7 +430,7 @@ Error in execute: select command denied to user: 'grant_user@localhost' for tabl
select * from mysql.user
Error in execute: select command denied to user: 'grant_user@localhost' for table 'user'
select * from mysql.db where user = 'grant_user'
-localhost grant_test grant_user N Y N N N N N N N N
+localhost grant_test grant_user N Y N N N N N N N N N N
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv where user = 'grant_user'
select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv where user = 'grant_user'
@@ -465,7 +465,7 @@ Error in execute: Access denied for user: 'grant_user@localhost' (Using password
grant SELECT on grant_test.test3 to grant_user@localhost
Connecting grant_user
LOCK TABLES grant_test.test3 READ
-Error in execute: Access denied for user: 'grant_user@localhost' (Using password: NO)
+Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant LOCK TABLES on *.* to grant_user@localhost
show grants for grant_user@localhost
GRANT LOCK TABLES ON *.* TO 'grant_user'@'localhost'
@@ -480,8 +480,9 @@ LOCK TABLES grant_test.test3 READ
UNLOCK TABLES
revoke SELECT,INSERT,UPDATE,DELETE on grant_test.test3 from grant_user@localhost
Connecting grant_user
-Access denied for user: 'grant_user@localhost' to database 'grant_test'
revoke LOCK TABLES on *.* from grant_user@localhost
+Connecting grant_user
+Access denied for user: 'grant_user@localhost' to database 'grant_test'
drop table grant_test.test3
show grants for grant_user@localhost
grant all on *.* to grant_user@localhost WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 2 MAX_CONNECTIONS_PER_HOUR 3
diff --git a/vio/docs/COPYING.dbug b/vio/docs/COPYING.dbug
deleted file mode 100644
index e1b6463c09b..00000000000
--- a/vio/docs/COPYING.dbug
+++ /dev/null
@@ -1,29 +0,0 @@
-/******************************************************************************
- * *
- * N O T I C E *
- * *
- * Copyright Abandoned, 1987, Fred Fish *
- * *
- * *
- * This previously copyrighted work has been placed into the public *
- * domain by the author and may be freely used for any purpose, *
- * private or commercial. *
- * *
- * Because of the number of inquiries I was receiving about the use *
- * of this product in commercially developed works I have decided to *
- * simply make it public domain to further its unrestricted use. I *
- * specifically would be most happy to see this material become a *
- * part of the standard Unix distributions by AT&T and the Berkeley *
- * Computer Science Research Group, and a standard part of the GNU *
- * system from the Free Software Foundation. *
- * *
- * I would appreciate it, as a courtesy, if this notice is left in *
- * all copies and derivative works. Thank you. *
- * *
- * The author makes no warranty of any kind with respect to this *
- * product and explicitly disclaims any implied warranties of mer- *
- * chantability or fitness for any particular purpose. *
- * *
- ******************************************************************************
- */
-
diff --git a/vio/docs/COPYING.mysql b/vio/docs/COPYING.mysql
deleted file mode 100644
index c2028f07298..00000000000
--- a/vio/docs/COPYING.mysql
+++ /dev/null
@@ -1,193 +0,0 @@
-The *MySQL* server license for non Microsoft operating systems
-**************************************************************
-
- *MySQL FREE PUBLIC LICENSE*
-
- (Version 4, March 5, 1995)
-
- Copyright (C) 1995, 1996 TcX AB & Monty Program KB & Detron HB
-
- Stockholm SWEDEN, Helsingfors FINLAND and Uppsala SWEDEN
-
- All rights reserved.
-
-NOTE: This license is not the same as any of the GNU Licenses published
-by the Free Software Foundation. Its terms are substantially different
-from those of the GNU Licenses. If you are familiar with the GNU
-Licenses, please read this license with extra care.
-
-This License applies to the computer program known as "MySQL". The
-"Program", below, refers to such program, and a "work based on the
-Program" means either the Program or any derivative work of the Program,
-as defined in the United States Copyright Act of 1976, such as a
-translation or a modification. The Program is a copyrighted work whose
-copyright is held by TcX Datakonsult AB and Monty Program KB and Detron
-HB.
-
-This License does not apply when running "MySQL" on any Microsoft
-operating system. Microsoft operating systems include all versions of
-Microsoft Windows NT and Microsoft Windows.
-
-BY MODIFYING OR DISTRIBUTING THE PROGRAM (OR ANY WORK BASED ON THE
-PROGRAM), YOU INDICATE YOUR ACCEPTANCE OF THIS LICENSE TO DO SO, AND ALL
-ITS TERMS AND CONDITIONS FOR COPYING, DISTRIBUTING OR MODIFYING THE
-PROGRAM OR WORKS BASED ON IT. NOTHING OTHER THAN THIS LICENSE GRANTS
-YOU PERMISSION TO MODIFY OR DISTRIBUTE THE PROGRAM OR ITS DERIVATIVE
-WORKS. THESE ACTIONS ARE PROHIBITED BY LAW. IF YOU DO NOT ACCEPT THESE
-TERMS AND CONDITIONS, DO NOT MODIFY OR DISTRIBUTE THE PROGRAM.
-
- 1. Licenses.
-
- Licensor hereby grants you the following rights, provided that you
- comply with all of the restrictions set forth in this License and
- provided, further, that you distribute an unmodified copy of this
- License with the Program:
-
- a. You may copy and distribute literal (i.e., verbatim) copies
- of the Program's source code as you receive it throughout the
- world, in any medium.
-
- b. You may modify the Program, create works based on the Program
- and distribute copies of such throughout the world, in any
- medium.
-
- 2. Restrictions.
-
- This license is subject to the following restrictions:
- a. Distribution of the Program or any work based on the Program
- by a commercial organization to any third party is prohibited
- if any payment is made in connection with such distribution,
- whether directly (as in payment for a copy of the Program) or
- indirectly (as in payment for some service related to the
- Program, or payment for some product or service that includes
- a copy of the Program "without charge"; these are only
- examples, and not an exhaustive enumeration of prohibited
- activities). However, the following methods of distribution
- involving payment shall not in and of themselves be a
- violation of this restriction:
-
- A. Posting the Program on a public access information
- storage and retrieval service for which a fee is
- received for retrieving information (such as an on-line
- service), provided that the fee is not content-dependent
- (i.e., the fee would be the same for retrieving the same
- volume of information consisting of random data).
-
- B. Distributing the Program on a CD-ROM, provided that the
- files containing the Program are reproduced entirely and
- verbatim on such CD-ROM, and provided further that all
- information on such CD-ROM be redistributable for
- non-commercial purposes without charge.
-
- b. Activities other than copying, distribution and modification
- of the Program are not subject to this License and they are
- outside its scope. Functional use (running) of the Program
- is not restricted, and any output produced through the use of
- the Program is subject to this license only if its contents
- constitute a work based on the Program (independent of having
- been made by running the Program).
-
- c. You must meet all of the following conditions with respect to
- the distribution of any work based on the Program:
- A. If you have modified the Program, you must cause your
- work to carry prominent notices stating that you have
- modified the Program's files and the date of any change;
-
- B. You must cause any work that you distribute or publish,
- that in whole or in part contains or is derived from the
- Program or any part thereof, to be licensed as a whole
- and at no charge to all third parties under the terms of
- this License;
-
- C. If the modified program normally reads commands
- interactively when run, you must cause it, at each time
- the modified program commences operation, to print or
- display an announcement including an appropriate
- copyright notice and a notice that there is no warranty
- (or else, saying that you provide a warranty). Such
- notice must also state that users may redistribute the
- Program only under the conditions of this License and
- tell the user how to view the copy of this License
- included with the Program. (Exception: if the Program
- itself is interactive but does not normally print such
- an announcement, your work based on the Program is not
- required to print an announcement.);
-
- D. You must accompany any such work based on the Program
- with the complete corresponding machine-readable source
- code, delivered on a medium customarily used for
- software interchange. The source code for a work means
- the preferred form of the work for making modifications
- to it. For an executable work, complete source code
- means all the source code for all modules it contains,
- plus any associated interface definition files, plus the
- scripts used to control compilation and installation of
- the executable code. However, the source code
- distributed need not include anything that is normally
- distributed (in either source or binary form) with the
- major components (compiler, kernel, and so on) of the
- operating system on which the executable runs, unless
- that component itself accompanies the executable code;
-
- E. If you distribute any written or printed material at all
- with the Program or any work based on the Program, such
- material must include either a written copy of this
- License, or a prominent written indication that the
- Program or the work based on the Program is covered by
- this License and written instructions for printing
- and/or displaying the copy of the License on the
- distribution medium;
-
- F. You may not impose any further restrictions on the
- recipient's exercise of the rights granted herein.
-
- If distribution of executable or object code is made by
- offering the equivalent ability to copy from a
- designated place, then offering equivalent ability to
- copy the source code from the same place counts as
- distribution of the source code, even though third
- parties are not compelled to copy the source code along
- with the object code.
-
- 3. Reservation of Rights.
-
- No rights are granted to the Program except as expressly set forth
- herein. You may not copy, modify, sublicense, or distribute the
- Program except as expressly provided under this License. Any
- attempt otherwise to copy, modify, sublicense or distribute the
- Program is void, and will automatically terminate your rights
- under this License. However, parties who have received copies, or
- rights, from you under this License will not have their licenses
- terminated so long as such parties remain in full compliance.
-
- 4. Other Restrictions.
-
- If the distribution and/or use of the Program is restricted in
- certain countries for any reason, Licensor may add an explicit
- geographical distribution limitation excluding those countries, so
- that distribution is permitted only in or among countries not thus
- excluded. In such case, this License incorporates the limitation
- as if written in the body of this License.
-
- 5. Limitations.
-
- THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS
- NO WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
- QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
- SERVICING, REPAIR OR CORRECTION.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
- WRITING WILL LICENSOR, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
- DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
- THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
- BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGES.
-
diff --git a/vio/docs/CodingStyle b/vio/docs/CodingStyle
deleted file mode 100644
index 7231b369d18..00000000000
--- a/vio/docs/CodingStyle
+++ /dev/null
@@ -1,8 +0,0 @@
-Roughly the same as "Linux Kernel Coding Style", which is
-included in file LinuxKernelCodingStyle.
-
-Some methods are meant to be used as set/get, for example, there
-are:
-virtual bool Vio::blocking();
-virtual int Vio::blocking(bool block);
-
diff --git a/vio/docs/README b/vio/docs/README
deleted file mode 100644
index 9fb3255236f..00000000000
--- a/vio/docs/README
+++ /dev/null
@@ -1,18 +0,0 @@
-Virtual IO library.
-IO wrappers for sockets, fd-s, SSL.
-Languages:C++
-
-This library is based on work of many others.
-They have different policies and I haven't thought up
-about resulting licence - GPL, L(essen)GPL, BSD-style, whatever.
-The licences are here for reference:
-COPYING.mysql: MySQL licence. Some socket functions.
-COPYING.dbug: Fred Fish's dbug library. I use it extensively ;=)
-COPYING.openssl:OpenSSL licence. SSL wrappers.
-
-At the moment there is no real 'Makefile', just config.mk/targets.mk
-and Makefile.am to build it as a module in MySQL. Therefore, there
-is currently no possibility to build it as a separate library, but
-with MySQL-s root Makefile it should just a matter of leaving
-everything else out.
-
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 2c6cdb5a7fd..f69eebd413a 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -120,7 +120,6 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d",
(int) set_blocking_mode, (int) *old_mode));
-#if !defined(HAVE_OPENSSL)
#if !defined(___WIN__) && !defined(__EMX__)
#if !defined(NO_FCNTL_NONBLOCK)
if (vio->sd >= 0)
@@ -161,7 +160,6 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
r= test(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode;
#endif /* __EMX__ */
#endif /* !defined(__WIN__) && !defined(__EMX__) */
-#endif /* !defined (HAVE_OPENSSL) */
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
}
diff --git a/vio/viossl.c b/vio/viossl.c
index 6d4f5450148..56d3da8a1ac 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -44,28 +44,30 @@ report_errors()
unsigned long l;
const char* file;
const char* data;
- int line,flags, any_ssl_error = 0;
+ int line,flags;
DBUG_ENTER("report_errors");
- while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
+ while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)))
{
- char buf[200];
- any_ssl_error = 1;
+ char buf[512];
DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf),
file,line,(flags&ERR_TXT_STRING)?data:"")) ;
}
- if (!any_ssl_error) {
- DBUG_PRINT("info", ("No OpenSSL errors."));
- }
- DBUG_PRINT("info", ("BTW, errno=%d", socket_errno));
+ DBUG_PRINT("info", ("errno: %d", socket_errno));
DBUG_VOID_RETURN;
}
+/*
+ Delete a vio object
+
+ SYNPOSIS
+ vio_ssl_delete()
+ vio Vio object. May be 0.
+*/
+
void vio_ssl_delete(Vio * vio)
{
- /* It must be safe to delete null pointers. */
- /* This matches the semantics of C++'s delete operator. */
if (vio)
{
if (vio->type != VIO_CLOSED)
@@ -74,6 +76,7 @@ void vio_ssl_delete(Vio * vio)
}
}
+
int vio_ssl_errno(Vio *vio __attribute__((unused)))
{
return socket_errno; /* On Win32 this mapped to WSAGetLastError() */
@@ -87,17 +90,12 @@ int vio_ssl_read(Vio * vio, gptr buf, int size)
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d, ssl_=%p",
vio->sd, buf, size, vio->ssl_));
-#ifndef DBUG_OFF
- errno = 0;
-#endif /* DBUG_OFF */
- r = SSL_read(vio->ssl_, buf, size);
-#ifndef DBUG_OFF
- if ( r<= 0) {
- r=SSL_get_error(vio->ssl_, r);
- DBUG_PRINT("info",("SSL_get_error returned %d",r));
+ if ((r= SSL_read(vio->ssl_, buf, size)) < 0)
+ {
+ int err= SSL_get_error(vio->ssl_, r);
+ DBUG_PRINT("error",("SSL_read(): %d SSL_get_error(): %d", r, err));
report_errors();
}
-#endif /* DBUG_OFF */
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
}
@@ -109,14 +107,8 @@ int vio_ssl_write(Vio * vio, const gptr buf, int size)
DBUG_ENTER("vio_ssl_write");
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size));
-#ifndef DBUG_OFF
- errno = 0;
-#endif /* DBUG_OFF */
- r = SSL_write(vio->ssl_, buf, size);
-#ifndef DBUG_OFF
- if (r<0)
+ if ((r= SSL_write(vio->ssl_, buf, size)) < 0)
report_errors();
-#endif /* DBUG_OFF */
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
}
@@ -124,7 +116,7 @@ int vio_ssl_write(Vio * vio, const gptr buf, int size)
int vio_ssl_fastsend(Vio * vio __attribute__((unused)))
{
- int r=0;
+ int r= 0;
DBUG_ENTER("vio_ssl_fastsend");
#ifdef IPTOS_THROUGHPUT
@@ -148,19 +140,18 @@ int vio_ssl_fastsend(Vio * vio __attribute__((unused)))
DBUG_RETURN(r);
}
+
int vio_ssl_keepalive(Vio* vio, my_bool set_keep_alive)
{
int r=0;
- uint opt = 0;
DBUG_ENTER("vio_ssl_keepalive");
DBUG_PRINT("enter", ("sd=%d, set_keep_alive=%d", vio->sd, (int)
set_keep_alive));
if (vio->type != VIO_TYPE_NAMEDPIPE)
{
- if (set_keep_alive)
- opt = 1;
- r = setsockopt(vio->sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt,
- sizeof(opt));
+ uint opt = (set_keep_alive) ? 1 : 0;
+ r= setsockopt(vio->sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt,
+ sizeof(opt));
}
DBUG_RETURN(r);
}
@@ -186,10 +177,13 @@ int vio_ssl_close(Vio * vio)
SSL_free(vio->ssl_);
vio->ssl_= 0;
}
- if (shutdown(vio->sd,2))
- r= -1;
- if (closesocket(vio->sd))
- r= -1;
+ if (vio->sd >= 0)
+ {
+ if (shutdown(vio->sd, 2))
+ r= -1;
+ if (closesocket(vio->sd))
+ r= -1;
+ }
if (r)
{
DBUG_PRINT("error", ("close() failed, error: %d",socket_errno));
@@ -254,6 +248,10 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in)
}
+/*
+ TODO: Add documentation and error handling
+*/
+
void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
{
char *str;
@@ -263,6 +261,7 @@ void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
DBUG_ENTER("sslaccept");
DBUG_PRINT("enter", ("sd=%d ptr=%p", vio->sd,ptr));
+ vio_blocking(vio, 1, &unused); /* Must be called before reset */
vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE);
vio->ssl_=0;
vio->open_=FALSE;
@@ -274,7 +273,6 @@ void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
}
DBUG_PRINT("info", ("ssl_=%p timeout=%ld",vio->ssl_, timeout));
SSL_clear(vio->ssl_);
- vio_blocking(vio, FALSE, &unused);
SSL_SESSION_set_timeout(SSL_get_session(vio->ssl_), timeout);
SSL_set_fd(vio->ssl_,vio->sd);
SSL_set_accept_state(vio->ssl_);
@@ -284,7 +282,8 @@ void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
DBUG_PRINT("info",("SSL_get_cipher_name() = '%s'"
,SSL_get_cipher_name(vio->ssl_)));
client_cert = SSL_get_peer_certificate (vio->ssl_);
- if (client_cert != NULL) {
+ if (client_cert != NULL)
+ {
DBUG_PRINT("info",("Client certificate:"));
str = X509_NAME_oneline (X509_get_subject_name (client_cert), 0, 0);
DBUG_PRINT("info",("\t subject: %s", str));
@@ -295,11 +294,12 @@ void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
free (str);
X509_free (client_cert);
- } else
+ }
+ else
DBUG_PRINT("info",("Client does not have certificate."));
str=SSL_get_shared_ciphers(vio->ssl_, buf, sizeof(buf));
- if(str)
+ if (str)
{
DBUG_PRINT("info",("SSL_get_shared_ciphers() returned '%s'",str));
}
@@ -313,7 +313,7 @@ void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
}
-void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
+int sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
{
char *str;
X509* server_cert;
@@ -321,6 +321,7 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
DBUG_ENTER("sslconnect");
DBUG_PRINT("enter", ("sd=%d ptr=%p ctx: %p", vio->sd,ptr,ptr->ssl_context_));
+ vio_blocking(vio, 1, &unused); /* Must be called before reset */
vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE);
vio->ssl_=0;
vio->open_=FALSE;
@@ -328,11 +329,10 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
{
DBUG_PRINT("error", ("SSL_new failure"));
report_errors();
- DBUG_VOID_RETURN;
+ DBUG_RETURN(1);
}
DBUG_PRINT("info", ("ssl_=%p timeout=%ld",vio->ssl_, timeout));
SSL_clear(vio->ssl_);
- vio_blocking(vio, FALSE, &unused);
SSL_SESSION_set_timeout(SSL_get_session(vio->ssl_), timeout);
SSL_set_fd (vio->ssl_, vio->sd);
SSL_set_connect_state(vio->ssl_);
@@ -342,24 +342,27 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
DBUG_PRINT("info",("SSL_get_cipher_name() = '%s'"
,SSL_get_cipher_name(vio->ssl_)));
server_cert = SSL_get_peer_certificate (vio->ssl_);
- if (server_cert != NULL) {
+ if (server_cert != NULL)
+ {
DBUG_PRINT("info",("Server certificate:"));
str = X509_NAME_oneline (X509_get_subject_name (server_cert), 0, 0);
DBUG_PRINT("info",("\t subject: %s", str));
- free (str);
+ free(str);
str = X509_NAME_oneline (X509_get_issuer_name (server_cert), 0, 0);
DBUG_PRINT("info",("\t issuer: %s", str));
- free (str);
-
- /* We could do all sorts of certificate verification stuff here before
- * deallocating the certificate. */
+ free(str);
+ /*
+ We could do all sorts of certificate verification stuff here before
+ deallocating the certificate.
+ */
X509_free (server_cert);
- } else
+ }
+ else
DBUG_PRINT("info",("Server does not have certificate."));
#endif
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 23a35f540f6..9e7a1475951 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -71,9 +71,11 @@ report_errors()
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
{
+#ifndef DBUG_OFF /* Avoid warning */
char buf[200];
DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf),
file,line,(flags & ERR_TXT_STRING) ? data : "")) ;
+#endif
}
DBUG_VOID_RETURN;
}