Merge for BUG#3759 which was missing from the main tree for some reason.

BitKeeper/etc/logging_ok:
  auto-union
sql/item_cmpfunc.h:
  Auto merged
mysql-test/r/select.result:
  Merge for BUG#3759
mysql-test/t/select.test:
  Merge for BUG#3759
This commit is contained in:
unknown 2004-11-25 11:37:28 +02:00
commit 0dcb55f470
210 changed files with 4184 additions and 1403 deletions

View file

@ -545,3 +545,4 @@ vio/test-sslserver
vio/viotest-ssl
scripts/make_win_binary_distribution
EXCEPTIONS-CLIENT
support-files/my-innodb-heavy-4G.cnf

View file

@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
antony@ltantony.dsl-verizon.net
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@bitbike.com
arjen@co3064164-a.bitbike.com
arjen@fred.bitbike.com
@ -20,8 +21,10 @@ bar@mysql.com
bell@laptop.sanja.is.com.ua
bell@sanja.is.com.ua
bk@admin.bk
brian@brian-akers-computer.local
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
dellis@goetia.(none)
dlenev@brandersnatch.localdomain
dlenev@build.mysql.com
dlenev@mysql.com
@ -33,6 +36,7 @@ greg@mysql.com
guilhem@mysql.com
gweir@build.mysql.com
gweir@work.mysql.com
hartmut@mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
heikki@rescue.
@ -43,7 +47,9 @@ hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
ingo@mysql.com
jani@a193-229-222-105.elisa-laajakaista.fi
jani@a80-186-24-72.elisa-laajakaista.fi
jani@a80-186-41-201.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
@ -66,6 +72,7 @@ kostja@oak.local
lenz@kallisto.mysql.com
lenz@mysql.com
marko@hundin.mysql.fi
matt@mysql.com
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.local
@ -133,6 +140,7 @@ tim@bitch.mysql.fi
tim@black.box
tim@hundin.mysql.fi
tim@sand.box
tim@siva.hindu.god
tim@threads.polyesthetic.msg
tim@white.box
tim@work.mysql.com

View file

@ -288,6 +288,10 @@ unless ($opt_skip_manual)
system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0
or &abort("Could not update $file.texi in $target_dir/Docs/!");
}
system ("rm -f $target_dir/Docs/Images/Makefile*") == 0
or &abort("Could not remove Makefiles in $target_dir/Docs/Images/!");
system ("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images") == 0
or &abort("Could not copy image files in $target_dir/Docs/Images/!");
}
#

View file

@ -10,7 +10,7 @@ use Sys::Hostname;
$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_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=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=0;
$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$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=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=0;
$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=$opt_without_ndbcluster=0;
GetOptions(
@ -36,6 +36,7 @@ GetOptions(
"no-test",
"no-mysqltest",
"no-benchmark",
"one-error",
"perl-files=s",
"perl-options=s",
"raid",
@ -298,6 +299,7 @@ if ($opt_stage <= 2)
$command=$make;
$command.= " $opt_make_options" if (defined($opt_make_options) && $opt_make_options ne "");
safe_system($command);
print LOG "Do-compile: Build successful\n";
}
#
@ -358,10 +360,16 @@ $ENV{"LD_LIBRARY_PATH"}= ("$test_dir/lib" .
#
if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{
my $force= "";
if (!$opt_one_error)
{
$force= "--force"; # default
}
log_timestamp();
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
check_system("./mysql-test-run $force --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
# 'mysql-test-run' writes its own final message for log evaluation.
}
#
@ -535,7 +543,10 @@ Do not run any tests.
Do not run the benchmark test (written in perl)
--no-mysqltest
Do not run the the mysql-test-run test (Same as 'make test')
Do not run the mysql-test-run test (Same as 'make test')
--one-error
Terminate the mysql-test-run test after the first difference (default: use '--force')
--perl-files=list of files
Compile and install the given perl modules.

View file

@ -1,9 +1,9 @@
#!/usr/bin/perl -i
#!/usr/bin/perl -wi
# Untar a MySQL distribution, change the copyright texts,
# pack it up again to a given directory
$VER="1.3";
$VER="1.5";
use Cwd;
use File::Basename;
@ -79,7 +79,7 @@ sub main
$newdistname .= $suffix if $win_flag;
}
# find out the extract path (should be same as distname!)
chomp($destdir = `tar ztf ../$distfile | head -1`);
chomp($destdir= `tar ztf ../$distfile | head -1`);
# remove slash from the end
$destdir= substr($destdir, 0, -1);
@ -103,34 +103,25 @@ sub main
unlink("$destdir/PUBLIC", "$destdir/README");
unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT");
copy("$WD/Docs/MySQLEULA.txt", "$destdir");
# remove readline subdir and update configure accordingly
system("rm -rf $destdir/cmd-line-utils/readline");
if ($win_flag) {
chdir("$destdir") or (print "$! Unable to change directory to $destdir!\n" && exit(0));
} else {
chdir("$destdir");
unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
open(CONFIGURE,"<configure.in") or die "$! Unable to open configure.in to read from!\n";
local $/;
undef $/;
my $configure = <CONFIGURE>;
close(CONFIGURE);
$configure =~ s|cmd\-line\-utils/readline/Makefile dnl\n?||g;
open(CONFIGURE,">configure.in") or die "$! Unable to open configure.in to write to!\n";
print CONFIGURE $configure;
close(CONFIGURE);
`aclocal && autoheader && aclocal && automake && autoconf`;
if (! -f "configure") {
print "\"./configure\" was not produced, exiting!\n";
exit(0);
}
# remove subdirectories 'bdb', 'cmd-line-utils/readline'
my @extra_fat= ('bdb', 'cmd-line-utils/readline');
foreach my $fat (@extra_fat)
{
&trim_the_fat($fat);
}
# fix file copyrights
&fix_usage_copyright();
&add_copyright();
# fix LICENSE tag in include/mysql_version.h
&fix_mysql_version();
# apply "autotools" - must be last to ensure proper timestamps
&run_autotools();
# rename the directory with new distribution name
chdir("$WD/$dir");
print "renaming $destdir $newdistname\n" if $opt_verbose;
@ -143,7 +134,6 @@ sub main
# remove temporary directory
chdir($WD) or print "$! Unable to move up one dir\n";
`cd $WD`;
my $cwd = getcwd();
print "current dir is $cwd\n" if $opt_verbose ;
if (-e $dir) {
@ -154,7 +144,111 @@ sub main
}
}
exit(0);
}
}
####
#### This function will s/GPL/Commercial/ in include/mysql_version.h for the
#### LICENSE tag.
####
sub fix_mysql_version
{
my $cwd= getcwd();
chdir("$destdir");
my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n";
undef $/;
my $mysql_version= <MYSQL_VERSION>;
close(MYSQL_VERSION);
$mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n";
print MYSQL_VERSION $mysql_version;
close(MYSQL_VERSION);
chdir("$cwd");
}
####
#### This function will remove unwanted parts of a src tree for the mysqlcom
#### distributions.
####
sub trim_the_fat
{
my $the_fat= shift;
my $cwd= getcwd();
chdir("$destdir");
if ( -d "${the_fat}" )
{
system("rm -rf ${the_fat}");
if (!$win_flag)
{
open(CONFIG_IN,"<configure.in") or die "Unable to open configure.in for read: $!\n";
undef $/;
my $config_in= <CONFIG_IN>;
close(CONFIG_IN);
#
# If $the_fat Makefile line closes the parenthesis, then
# replace that line with just the closing parenthesis.
#
if ($config_in=~ m|${the_fat}/Makefile\)\n?|)
{
$config_in=~ s|${the_fat}/Makefile(\)\n?)|$1|;
}
#
# Else just delete the line
#
else
{
$config_in=~ s|${the_fat}/Makefile dnl\n?||;
}
open(CONFIG_IN,">configure.in") or die "Unable to open configure.in for write: $!\n";
print CONFIG_IN $config_in;
close(CONFIG_IN);
}
}
chdir("$cwd");
}
####
#### This function will run the autotools on the reduced source tree.
####
sub run_autotools
{
my $cwd= getcwd();
if (!$win_flag)
{
chdir("$destdir");
unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
# File "configure.in" has already been modified by "trim_the_fat()"
# It must be ensured that the timestamps of the relevant files are really
# ascending, for otherwise the Makefile may cause a re-run of these
# autotools. Experience shows that deletion is the only safe way.
unlink ("config.h.in") or die "Can't delete $destdir/config.h.in: $!\n";
unlink ("aclocal.m4") or die "Can't delete $destdir/aclocal.m4: $!\n";
# These sleep commands also ensure the ascending order.
`aclocal && sleep 2 && autoheader && sleep 2 && automake && sleep 2 && autoconf`;
die "'./configure' was not produced!" unless (-f "configure");
if (-d "autom4te.cache") {
print "Trying to delete autom4te.cache dir\n" if $opt_verbose;
system("rm -rf autom4te.cache") or print "Unable to delete autom4te.cache dir: $!\n";
}
chdir("$cwd");
}
}
####
#### mysqld and MySQL client programs have a usage printed with --help.
@ -187,6 +281,7 @@ sub add_copyright
foreach my $file (@files)
{
next if ! -f $file;
next if -B $file;
print "processing file $file in cwd $cwd\n" if $opt_verbose;
`$WD/Build-tools/mysql-copyright-2 "$file"`;
}

View file

@ -90,6 +90,7 @@ sub add_copyright
$ARGV =~ /\.cc$/ ||
$ARGV =~ /\.h$/ ||
$ARGV =~ /\.cpp$/ ||
$ARGV =~ /\.txt$/ ||
$ARGV =~ /\.yy$/)
{
$start_copyright="/* ";

35
Docs/Images/Makefile.am Normal file
View file

@ -0,0 +1,35 @@
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
## Process this file with automake to create Makefile.in
# This is a dummy file to satisfy the hierarchy of Makefiles.
# When a release is built, the true Makefile will be copied
# together with the "real" files in this directory.
EXTRA_DIST =
# Nothing to create in this dummy directory.
all:
:
# Nothing to cleanup in this dummy directory.
clean:
:
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -9,7 +9,7 @@
# If you know how to fix any of this more elegantly please mail
# docs@mysql.com
TEXI2HTML_FLAGS = -iso -number
TEXI2HTML_FLAGS = -iso -number -acc
DVIPS = dvips
MAKEINFO = @MAKEINFO@
TEXINFO_TEX = Support/texinfo.tex
@ -24,6 +24,8 @@ BUILT_SOURCES = $(targets) manual_toc.html include.texi
EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
INSTALL-BINARY reservedwords.texi
SUBDIRS = Images
all: $(targets) txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../EXCEPTIONS-CLIENT \

View file

@ -1,4 +1,4 @@
#!PATH_TO_PERL -*- perl -*-
#!/usr/bin/perl
# Add path to perl on the previous line and make this executable
# if you want to use this as a normal script.
'di ';
@ -12,7 +12,7 @@
#-##############################################################################
# @(#)texi2html 1.52 971230 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch
# Enhanced by David Axmark, david@detron.se
# Enhanced by David Axmark
# The man page for this program is included at the end of this file and can be
# viewed using the command 'nroff -man texi2html'.
@ -40,8 +40,7 @@ $NODESRE = '[^@{}:\'`"]+'; # RE for a list of node names
$XREFRE = '[^@{}]+'; # RE for a xref (should use NODERE)
$ERROR = "***"; # prefix for errors and warnings
$THISPROG = "texi2html 1.52 (hacked by david\@detron.se)"; # program name and version
$HOMEPAGE = "http://www.mathematik.uni-kl.de/~obachman/Texi2html/"; # program home page
$THISPROG = "texi2html 1.52 (with additions by MySQL AB)"; # program name and version
$TODAY = &pretty_date; # like "20 September 1993"
$SPLITTAG = "<!-- SPLIT HERE -->\n"; # tag to know where to split
$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections
@ -114,10 +113,12 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
#
%accent_map = (
'"', 'uml',
'\'', 'acute',
',{', 'cedil',
'~', 'tilde',
'^', 'circ',
'`', 'grave',
'\'', 'acute',
'ringaccent{', 'ring',
);
#
@ -125,7 +126,7 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
#
%simple_map = (
# cf. makeinfo.c
"*", "<BR>", # HTML+
"*", "<br />", # HTML+
" ", " ",
"\n", "\n",
"|", "",
@ -134,6 +135,8 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
"!", "!",
"?", "?",
".", ".",
# @- means "allow word break", not &mdash;
"-", "",
);
#
@ -141,9 +144,10 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
#
%things_map = (
'TeX', 'TeX',
'br', '<P>', # paragraph break
'br', '<p>', # paragraph break
'bullet', '*',
'copyright', '(C)',
'registeredsymbol', '(R)',
'dots', '...',
'equiv', '==',
'error', 'error-->',
@ -161,27 +165,28 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
%style_map = (
'asis', '',
'b', 'B',
'cite', 'CITE',
'code', 'CODE',
'cite', 'cite',
'code', 'code',
'command', 'code',
'ctrl', '&do_ctrl', # special case
'dfn', 'STRONG', # DFN tag is illegal in the standard
'dfn', 'strong', # DFN tag is illegal in the standard
'dmn', '', # useless
'email', '&fix_email', # special
'emph', 'EM',
'file', '"TT', # will put quotes, cf. &apply_style
'i', 'I',
'kbd', 'KBD',
'key', 'KBD',
'emph', 'em',
'file', '"tt', # will put quotes, cf. &apply_style
'i', 'i',
'kbd', 'kbd',
'key', 'kbd',
'r', '', # unsupported
'samp', '"SAMP', # will put quotes, cf. &apply_style
'samp', '"samp', # will put quotes, cf. &apply_style
'sc', '&do_sc', # special case
'strong', 'STRONG',
't', 'TT',
'strong', 'strong',
't', 'tt',
'titlefont', '', # useless
'image', '&fix_image', # Image
'url', '&fix_url', # URL
'uref', '&fix_uref', # URL Reference
'var', 'VAR',
'var', 'var',
'w', '', # unsupported
);
@ -317,6 +322,7 @@ $usage = <<EOT;
This is $THISPROG
To convert a Texinfo file to HMTL: $0 [options] file
where options can be:
-acc : convert @"-like accents to &entities;
-expandinfo : use \@ifinfo sections, not \@iftex
-glossary : handle a glossary
-invisible name: use 'name' as an invisible anchor
@ -445,11 +451,15 @@ $html_num = 0;
if ($use_iso) {
$things_map{'bullet'} = "&bull;";
$things_map{'copyright'} = "&copy;";
$things_map{'registeredsymbol'} = "&reg;";
$things_map{'dots'} = "&hellip;";
$things_map{'equiv'} = "&equiv;";
$things_map{'expansion'} = "&rarr;";
$things_map{'point'} = "&lowast;";
$things_map{'result'} = "&rArr;";
$things_map{'ss'} = "&szlig;";
$things_map{'o'} = "&oslash;";
$things_map{'O'} = "&Oslash;";
}
#
@ -505,23 +515,27 @@ $html_element = ''; # current HTML element
# watch out for regexps, / and escaped characters!
$subst_code = '';
foreach (keys(%simple_map)) {
($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars
$subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";
$re = quotemeta $_; # protect regexp chars
$sub = quotemeta $simple_map{$_};
$subst_code .= "s/\\\@$re/$sub/g;\n";
}
foreach (keys(%things_map)) {
$subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";
$re = quotemeta $_; # protect regexp chars
$sub = quotemeta $things_map{$_};
$subst_code .= "s/\\\@$re\\{\\}/$sub/g;\n";
}
if ($use_acc) {
# accentuated characters
foreach (keys(%accent_map)) {
my $brace = /{$/ ? '}' : '';
if ($_ eq "`") {
$subst_code .= "s/$;3";
} elsif ($_ eq "'") {
$subst_code .= "s/$;4";
} else {
$subst_code .= "s/\\\@\\$_";
$subst_code .= "s/\\\@\\Q$_\\E";
}
$subst_code .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n";
$subst_code .= "(\\w)$brace/&\${1}$accent_map{$_};/gi;\n";
}
}
eval("sub simple_substitutions { $subst_code }");
@ -703,7 +717,7 @@ READ_LINE: while ($_ = &next_line)
s/{[^{}]+}//g);
print "# Multitable with $multitable_cols columns\n"
if $debug and $DEBUG_USER;
push(@lines, &debug("<TABLE BORDER WIDTH=\"100%\">\n", __LINE__));
push(@lines, &debug("<TABLE BORDER>\n", __LINE__));
} else {
warn "$ERROR Bad table line: $_";
}
@ -873,7 +887,7 @@ READ_LINE: while ($_ = &next_line)
&simple_substitutions;
s/\@value{($VARRE)}/$value{$1}/eg;
s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
s|\s+\@tab\s*| </TD><TD> |g if ($in_multitable);
s/(^|\s+)\@tab\s*/ <\/TD><TD> /g if ($in_multitable);
#
# analyze the tag again
@ -885,7 +899,7 @@ READ_LINE: while ($_ = &next_line)
$name =~ s/\s+$//;
$level = $sec2level{$tag};
$name = &update_sec_num($tag, $level) . " $name"
if $number_sections && $tag !~ /^unnumbered/;
if $number_sections && $tag !~ /^unnumbered/ && $tag ne 'subsubheading';
if ($tag =~ /heading$/) {
push(@lines, &html_debug("\n", __LINE__));
if ($html_element ne 'body') {
@ -1079,7 +1093,7 @@ EOC
push(@lines, &debug("</TD></TR>\n", __LINE__))
unless $html_element eq 'TABLE';
&html_pop_if('TR');
$what =~ s|\s+\@tab\s*| </TD><TD> |g;
$what =~ s/(^|\s+)\@tab\s*/ <\/TD><TD> /g;
push(@lines, &debug("<TR><TD>$what\n", __LINE__));
&html_push('TR');
if ($deferred_ref)
@ -1463,11 +1477,7 @@ print "# end of pass 4\n" if $verbose;
# #
#---############################################################################
$header = <<EOT;
<!-- This HTML file has been created by $THISPROG
from $docu on $TODAY -->
EOT
$header = '';
$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document";
$title = $value{'_settitle'} || $full_title;
$_ = &substitute_style($full_title);
@ -1811,12 +1821,14 @@ sub fix_image
{
my($text) = @_;
my($arg1, $ext);
$text =~ /^([^,]*)$/;
$text =~ /^([^,]*)/;
die "error in image: '$text'" unless defined($1);
$arg1 = $1;
$arg1 =~ s/@@/@/g;
$ext = "jpg" if -f "$arg1.jpg";
$ext = "gif" if -f "$arg1.gif";
foreach (@include_dirs) {
$ext = "jpg" if -f "$_/$arg1.jpg";
$ext = "gif" if -f "$_/$arg1.gif";
}
if (defined($ext))
{
"<IMG SRC=\"$arg1.$ext\">";
@ -2010,7 +2022,7 @@ sub print_toplevel_header
{
local($_);
&print_header; # pass given arg...
&print_header unless $opt_empty_headers; # pass given arg...
print FILE $full_title;
if ($value{'_subtitle'}) {
$value{'_subtitle'} =~ s/\n+$//;
@ -2042,13 +2054,7 @@ EOT
sub print_toplevel_footer
{
&print_ruler;
print FILE <<EOT;
This document was generated on $TODAY using the
<A HREF=\"$HOMEPAGE\">texi2html</A>
translator version 1.52 (extended by davida\@detron.se).</P>
EOT
&print_footer;
&print_footer unless $opt_empty_headers;
}
sub protect_texi
@ -2065,8 +2071,10 @@ sub protect_html
{
local($what) = @_;
# protect & < >
# Avoid loop in & replacement. This instead bugs out for &# in text..
$what =~ s/\&([^#]|$)/\&\#38;$1/g;
# hack for the two entity-like variable reference in existing examples
$what =~ s/\&(length|ts);/\&\#38;$1;/g;
# this leaves alone entities, but encodes standalone ampersands
$what =~ s/\&(?!([a-z0-9]+|#\d+);)/\&\#38;/ig;
$what =~ s/\</\&\#60;/g;
$what =~ s/\>/\&\#62;/g;
# but recognize some HTML things

View file

@ -22,7 +22,7 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
SUBDIRS = . include @docs_dirs@ @readline_dir@ \
@thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests \
@sql_server_dirs@ scripts @man_dirs@ tests \
BUILD netware os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@

View file

@ -788,7 +788,7 @@ AC_DEFUN(MYSQL_FIND_OPENSSL, [
AC_DEFUN(MYSQL_CHECK_OPENSSL, [
AC_MSG_CHECKING(for OpenSSL)
AC_ARG_WITH([openssl],
[ --with-openssl Include the OpenSSL support],
[ --with-openssl[=DIR] Include the OpenSSL support],
[openssl="$withval"],
[openssl=no])
@ -806,8 +806,19 @@ AC_MSG_CHECKING(for OpenSSL)
[openssl_libs="$withval"],
[openssl_libs=""])
if test "$openssl" = "yes"
if test "$openssl" != "no"
then
if test "$openssl" != "yes"
then
if test -z "$openssl_includes"
then
openssl_includes="$openssl/include"
fi
if test -z "$openssl_libs"
then
openssl_libs="$openssl/lib"
fi
fi
MYSQL_FIND_OPENSSL([$openssl_includes], [$openssl_libs])
#force VIO use
vio_dir="vio"
@ -843,6 +854,14 @@ AC_MSG_CHECKING(for OpenSSL)
NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs"
else
AC_MSG_RESULT(no)
if test ! -z "$openssl_includes"
then
AC_MSG_ERROR(Can't have --with-openssl-includes without --with-openssl);
fi
if test ! -z "$openssl_libs"
then
AC_MSG_ERROR(Can't have --with-openssl-libs without --with-openssl);
fi
fi
AC_SUBST(openssl_libs)
AC_SUBST(openssl_includes)

View file

@ -38,4 +38,5 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION, OPT_FRM };
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION, OPT_FRM,
OPT_HEXBLOB };

View file

@ -689,6 +689,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
while (*argument) *argument++= 'x'; // Destroy argument
if (*start)
start[1]=0 ;
tty_password= 0;
}
else
tty_password= 1;
@ -759,7 +760,7 @@ static int get_options(int argc, char **argv)
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
@ -2200,20 +2201,77 @@ static int com_source(String *buffer, char *line)
static int
com_use(String *buffer __attribute__((unused)), char *line)
{
char *tmp;
char buff[256];
char tmp[FN_REFLEN], buff[FN_REFLEN + 1];
MYSQL_RES *res;
MYSQL_ROW row;
char *c_buff, *c_tmp;
while (isspace(*line))
line++;
strnmov(buff,line,sizeof(buff)-1); // Don't destroy history
if (buff[0] == '\\') // Short command
buff[1]=' ';
tmp=(char *) strtok(buff," \t;"); // Skip connect command
if (!tmp || !(tmp=(char *) strtok(NullS," \t;")))
c_buff= buff;
while ((*c_buff != ' ') && (*c_buff != '\t')) // Skip connect command
c_buff++;
c_buff++;
while ((*c_buff == ' ') || (*c_buff == '\t'))
c_buff++;
c_tmp= tmp;
if (*c_buff == '`') // Handling backticks
{
c_buff++;
for (; *c_buff; c_tmp++)
{
if (*c_buff == '`')
{
if (c_buff[1] == '`')
{
*c_tmp= '`';
c_buff+= 2;
}
else
break;
}
else
*c_tmp= *(c_buff++);
}
}
else
for (; !strchr(" \t;", *c_buff); c_buff++, c_tmp++)
*c_tmp= *c_buff;
*c_tmp= '\0';
if (!*tmp)
{
put_info("USE must be followed by a database name",INFO_ERROR);
return 0;
}
/*
We need to recheck the current database, because it may change
under our feet, for example if DROP DATABASE or RENAME DATABASE
(latter one not yet available by the time the comment was written)
*/
/* Let's reset current_db, assume it's gone */
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
current_db= 0;
/*
We don't care about in case of an error below because current_db
was just set to 0.
*/
if (!mysql_query(&mysql, "SELECT DATABASE()") &&
(res= mysql_use_result(&mysql)))
{
row= mysql_fetch_row(res);
if (row[0])
{
current_db= my_strdup(row[0], MYF(MY_WME));
}
(void) mysql_fetch_row(res); // Read eof
mysql_free_result(res);
}
if (!current_db || cmp_database(current_db,tmp))
{
if (one_database)

View file

@ -246,7 +246,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc,char *argv[])
{
int error, ho_error;
int error= 0, ho_error;
MYSQL mysql;
char **commands, **save_argv;
@ -254,7 +254,7 @@ int main(int argc,char *argv[])
mysql_init(&mysql);
load_defaults("my",load_default_groups,&argc,&argv);
save_argv = argv; /* Save for free_defaults */
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
{
free_defaults(save_argv);
exit(ho_error);
@ -285,10 +285,25 @@ int main(int argc,char *argv[])
opt_ssl_capath, opt_ssl_cipher);
#endif
if (sql_connect(&mysql, option_wait))
error = 1;
{
unsigned int err= mysql_errno(&mysql);
if (err >= CR_MIN_ERROR && err <= CR_MAX_ERROR)
error= 1;
else
{
/* Return 0 if all commands are PING */
for (; argc > 0; argv++, argc--)
{
if (find_type(argv[0], &command_typelib, 2) != ADMIN_PING)
{
error= 1;
break;
}
}
}
}
else
{
error = 0;
while (!interrupted && (!opt_count_iterations || nr_iterations))
{
new_line = 0;
@ -539,7 +554,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
char *pos,buff[40];
ulong sec;
pos=strchr(status,' ');
pos= (char*) strchr(status,' ');
*pos++=0;
printf("%s\t\t\t",status); /* print label */
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec)))

View file

@ -559,7 +559,7 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;

View file

@ -273,7 +273,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my", load_default_groups, argc, argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (!what_to_do)
@ -413,18 +413,18 @@ static int process_all_tables_in_db(char *database)
LINT_INIT(res);
if (use_db(database))
return 1;
if (!(mysql_query(sock, "SHOW TABLES") ||
(res = mysql_store_result(sock))))
if (mysql_query(sock, "SHOW TABLES") ||
!((res= mysql_store_result(sock))))
return 1;
if (opt_all_in_1)
{
/*
/*
We need table list in form `a`, `b`, `c`
that's why we need 4 more chars added to to each table name
space is for more readable output in logs and in case of error
*/
char *tables, *end;
uint tot_length = 0;

View file

@ -78,7 +78,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0,
opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0;
opt_single_transaction=0, opt_comments= 0,
opt_hex_blob;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
@ -113,6 +114,9 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'i', "Write additional information.",
(gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"complete-insert", 'c', "Use complete insert statements.", (gptr*) &cFlag,
(gptr*) &cFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
@ -150,7 +154,7 @@ static struct my_option my_long_options[] =
"Fields in the i.file are opt. enclosed by ...", (gptr*) &opt_enclosed,
(gptr*) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
(gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, NO_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"first-slave", 'x', "Locks all tables across all databases.",
(gptr*) &opt_first_slave, (gptr*) &opt_first_slave, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
@ -165,6 +169,9 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"hex-blob", OPT_HEXBLOB, "Dump binary strings (CHAR BINARY, "
"VARCHAR BINARY, BLOB) in hexadecimal format.",
(gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
@ -179,10 +186,6 @@ static struct my_option my_long_options[] =
"Wrap tables with autocommit/commit statements.",
(gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"single-transaction", OPT_TRANSACTION,
"Dump all tables in single transaction to get consistent snapshot. Mutually exclusive with --lock-tables.",
(gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}",
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
@ -191,9 +194,6 @@ static struct my_option my_long_options[] =
(gptr*) &tFlag, (gptr*) &tFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
"Same as --add-drop-table --add-locks --all --quick --extended-insert --lock-tables --disable-keys",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -215,6 +215,13 @@ static struct my_option my_long_options[] =
{"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"single-transaction", OPT_TRANSACTION,
"Dump all tables in single transaction to get consistent snapshot. Mutually exclusive with --lock-tables.",
(gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"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},
@ -245,9 +252,6 @@ static struct my_option my_long_options[] =
(gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
MALLOC_OVERHEAD-1024, 1024, 0},
{"comments", 'i', "Write additional information.",
(gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -413,7 +417,7 @@ static int get_options(int *argc, char ***argv)
md_result_file= stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
@ -1104,6 +1108,7 @@ static void dumpTable(uint numFields, char *table)
for (i = 0; i < mysql_num_fields(res); i++)
{
int is_blob;
if (!(field = mysql_fetch_field(res)))
{
sprintf(query,"%s: Not enough fields from table %s! Aborting.\n",
@ -1112,6 +1117,14 @@ static void dumpTable(uint numFields, char *table)
error= EX_CONSCHECK;
goto err;
}
is_blob= (opt_hex_blob && (field->flags & BINARY_FLAG) &&
(field->type == FIELD_TYPE_STRING ||
field->type == FIELD_TYPE_VAR_STRING ||
field->type == FIELD_TYPE_BLOB ||
field->type == FIELD_TYPE_LONG_BLOB ||
field->type == FIELD_TYPE_MEDIUM_BLOB ||
field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
if (extended_insert)
{
ulong length = lengths[i];
@ -1126,18 +1139,37 @@ static void dumpTable(uint numFields, char *table)
{
if (!IS_NUM_FIELD(field))
{
/*
"length * 2 + 2" is OK for both HEX and non-HEX modes:
- In HEX mode we need exactly 2 bytes per character
plus 2 bytes for '0x' prefix.
- In non-HEX mode we need up to 2 bytes per character,
plus 2 bytes for leading and trailing '\'' characters.
*/
if (dynstr_realloc(&extended_row,length * 2+2))
{
fputs("Aborting dump (out of memory)",stderr);
error= EX_EOM;
goto err;
}
dynstr_append(&extended_row,"\'");
extended_row.length +=
if (opt_hex_blob && is_blob)
{
dynstr_append(&extended_row, "0x");
extended_row.length+= mysql_hex_string(extended_row.str +
extended_row.length,
row[i], length);
extended_row.str[extended_row.length]= '\0';
}
else
{
dynstr_append(&extended_row,"\'");
extended_row.length +=
mysql_real_escape_string(&mysql_connection,
&extended_row.str[extended_row.length],row[i],length);
extended_row.str[extended_row.length]='\0';
dynstr_append(&extended_row,"\'");
&extended_row.str[extended_row.length],
row[i],length);
extended_row.str[extended_row.length]='\0';
dynstr_append(&extended_row,"\'");
}
}
else
{
@ -1180,7 +1212,19 @@ static void dumpTable(uint numFields, char *table)
if (opt_xml)
print_quoted_xml(md_result_file, field->name, row[i],
lengths[i]);
else
else if (opt_hex_blob && is_blob)
{ /* sakaik got this idea. */
ulong counter;
char xx[4];
unsigned char *ptr= row[i];
fputs("0x", md_result_file);
for (counter = 0; counter < lengths[i]; counter++)
{
sprintf(xx, "%02X", ptr[counter]);
fputs(xx, md_result_file);
}
}
else
unescape(md_result_file, row[i], lengths[i]);
}
else

View file

@ -206,7 +206,7 @@ static int get_options(int *argc, char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (enclosed && opt_enclosed)
@ -246,10 +246,8 @@ static int write_to_table(char *filename, MYSQL *sock)
DBUG_ENTER("write_to_table");
DBUG_PRINT("enter",("filename: %s",filename));
local_file= sock->unix_socket == 0 || opt_local_file;
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
if (local_file)
if (! opt_local_file)
strmov(hard_path,filename);
else
my_load_path(hard_path, filename, NULL); /* filename includes the path */
@ -268,7 +266,7 @@ static int write_to_table(char *filename, MYSQL *sock)
to_unix_path(hard_path);
if (verbose)
{
if (local_file)
if (opt_local_file)
fprintf(stdout, "Loading data from LOCAL file: %s into %s\n",
hard_path, tablename);
else
@ -277,7 +275,7 @@ static int write_to_table(char *filename, MYSQL *sock)
}
sprintf(sql_statement, "LOAD DATA %s %s INFILE '%s'",
opt_low_priority ? "LOW_PRIORITY" : "",
local_file ? "LOCAL" : "", hard_path);
opt_local_file ? "LOCAL" : "", hard_path);
end= strend(sql_statement);
if (replace)
end= strmov(end, " REPLACE");

View file

@ -95,7 +95,7 @@ int parse_args(int argc, char** argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;

View file

@ -133,7 +133,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;

View file

@ -261,7 +261,7 @@ get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (tty_password)

View file

@ -2062,7 +2062,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
if ((handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(1);
if (argc > 1)

View file

@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 4.0.21)
AM_INIT_AUTOMAKE(mysql, 4.0.23)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -40,12 +40,12 @@ do
case $host_os in
netware* | modesto*)
echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err.linux \$^ $i/errmsg.sys" \
\$(top_builddir)/extra/comp_err.linux $i/errmsg.txt $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
*)
echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \
\$(top_builddir)/extra/comp_err $i/errmsg.txt $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
esac
@ -444,7 +444,7 @@ if $PS p $$ 2> /dev/null | grep $0 > /dev/null
then
FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
# Solaris
elif $PS -p $$ 2> /dev/null | grep $0 > /dev/null
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
then
FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null"
# BSD style
@ -939,8 +939,8 @@ MAX_CXX_OPTIMIZE="-O3"
# workaround for Sun Forte/x86 see BUG#4681
case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in
*solaris*-i?86-no)
CFLAGS="$CFLAGS -DBIG_FILES"
CXXFLAGS="$CXXFLAGS -DBIG_FILES"
CFLAGS="$CFLAGS -DBIG_TABLES"
CXXFLAGS="$CXXFLAGS -DBIG_TABLES"
;;
*) ;;
esac
@ -2181,6 +2181,21 @@ else
fi
AC_SUBST(docs_dirs)
# Shall we build the man pages?
AC_ARG_WITH(man,
[ --without-man Skip building of the man pages.],
[with_man=$withval],
[with_man=yes]
)
if test "$with_man" = "yes"
then
man_dirs="man"
else
man_dirs=""
fi
AC_SUBST(man_dirs)
# Shall we build the bench code?
AC_ARG_WITH(bench,
[ --without-bench Skip building of the benchmark suite.],
@ -2696,7 +2711,7 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
merge/Makefile dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile tools/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl
tests/Makefile Docs/Makefile Docs/Images/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile mysql-test/Makefile dnl
netware/Makefile dnl
include/mysql_version.h dnl

View file

@ -100,7 +100,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc < 1)

View file

@ -218,7 +218,7 @@ static int parse_args(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;

View file

@ -67,7 +67,7 @@ int main(int argc, char *argv[])
progname= argv[0];
if (handle_options(&argc, &argv, my_long_options, get_one_option, NULL))
if (handle_options(&argc, &argv, my_long_options, get_one_option))
exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0)

View file

@ -145,7 +145,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (!*argc && !print_all_codes)

View file

@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
/*

View file

@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc == 0)

View file

@ -218,7 +218,13 @@ inline double ulonglong2double(ulonglong value)
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((long *) (A)))
#define uint2korr(A) (*((uint16 *) (A)))
#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
/*
ATTENTION !
Please, note, uint3korr reads 4 bytes (not 3) !
It means, that you have to provide enough allocated space !
*/
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
#define uint4korr(A) (*((unsigned long *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\

View file

@ -50,15 +50,15 @@ struct my_option
int app_type; /* To be used by an application */
};
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts, my_get_one_option,
my_error_reporter );
const struct my_option *longopts, my_get_one_option);
extern void my_print_help(const struct my_option *options);
extern void my_print_variables(const struct my_option *options);

View file

@ -898,7 +898,13 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
#else
#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
/*
ATTENTION !
Please, note, uint3korr reads 4 bytes (not 3) !
It means, that you have to provide enough allocated space !
*/
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
#endif
#define uint4korr(A) (*((unsigned long *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\

View file

@ -96,6 +96,7 @@ typedef struct st_mi_create_info
ha_rows reloc_rows;
ulonglong auto_increment;
ulonglong data_file_length;
ulonglong key_file_length;
uint raid_type,raid_chunks;
ulong raid_chunksize;
uint old_options;

View file

@ -392,6 +392,8 @@ unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_hex_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);

View file

@ -609,8 +609,8 @@ btr_page_get_father_for_rec(
fputs(
"InnoDB: You should dump + drop + reimport the table to fix the\n"
"InnoDB: corruption. If the crash happens at the database startup, see\n"
"InnoDB: section 6.1 of http://www.innodb.com/ibman.php about forcing\n"
"InnoDB: recovery. Then dump + drop + reimport.\n", stderr);
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html about\n"
"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr);
}
ut_a(btr_node_ptr_get_child_page_no(node_ptr) ==

View file

@ -1561,9 +1561,9 @@ buf_page_io_complete(
"InnoDB: by dumping, dropping, and reimporting\n"
"InnoDB: the corrupt table. You can use CHECK\n"
"InnoDB: TABLE to scan your table for corruption.\n"
"InnoDB: Look also at section 6.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php about\n"
"InnoDB: forcing recovery.\n", stderr);
"InnoDB: See also "
"http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs(

View file

@ -1011,6 +1011,12 @@ dict_create_or_check_foreign_constraint_tables(void)
there are 2 secondary indexes on SYS_FOREIGN, and they
are defined just like below */
/* NOTE: when designing InnoDB's foreign key support in 2001, we made
an error and made the table names and the foreign key id of type
'CHAR' (internally, really a VARCHAR). We should have made the type
VARBINARY, like in other InnoDB system tables, to get a clean
design. */
str = (char *)
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n"
@ -1227,9 +1233,17 @@ loop:
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, foreign->id);
fputs("\nalready exists."
" (Note that internally InnoDB adds 'databasename/'\n"
" (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n",
ef);
fputs("Note that InnoDB's FOREIGN KEY system tables store\n"
"constraint names as case-insensitive, with the\n"
"MySQL standard latin1_swedish_ci collation. If you\n"
"create tables or databases whose names differ only in\n"
"the character case, then collisions in constraint\n"
"names can occur. Workaround: name your constraints\n"
"explicitly with unique names.\n",
ef);
mutex_exit(&dict_foreign_err_mutex);

View file

@ -132,7 +132,7 @@ dict_index_build_internal_non_clust(
dict_index_t* index); /* in: user representation of a non-clustered
index */
/**************************************************************************
Removes a foreign constraint struct from the dictionet cache. */
Removes a foreign constraint struct from the dictionary cache. */
static
void
dict_foreign_remove_from_cache(
@ -526,8 +526,10 @@ dict_index_contains_col_or_prefix(
}
/************************************************************************
Looks for a matching field in an index. The column and the prefix len have
to be the same. */
Looks for a matching field in an index. The column has to be the same. The
column in index must be complete, or must contain a prefix longer than the
column in index2. That is, we must be able to construct the prefix in index2
from the prefix in index. */
ulint
dict_index_get_nth_field_pos(
@ -555,7 +557,9 @@ dict_index_get_nth_field_pos(
field = dict_index_get_nth_field(index, pos);
if (field->col == field2->col
&& field->prefix_len == field2->prefix_len) {
&& (field->prefix_len == 0
|| (field->prefix_len >= field2->prefix_len
&& field2->prefix_len != 0))) {
return(pos);
}
@ -577,7 +581,7 @@ dict_table_get_on_id(
dict_table_t* table;
if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
|| trx->dict_operation) {
|| trx->dict_operation_lock_mode == RW_X_LATCH) {
/* It is a system table which will always exist in the table
cache: we avoid acquiring the dictionary mutex, because
if we are doing a rollback to handle an error in TABLE
@ -600,7 +604,7 @@ dict_table_get_on_id(
}
/************************************************************************
Looks for column n postion in the clustered index. */
Looks for column n position in the clustered index. */
ulint
dict_table_get_nth_col_pos(
@ -2020,7 +2024,8 @@ dict_foreign_error_report(
fputs("\nThe index in the foreign key in table is ", file);
ut_print_name(file, fk->foreign_index->name);
fputs(
"See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
"\nSee http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
"for correct foreign key definition.\n",
file);
}
mutex_exit(&dict_foreign_err_mutex);
@ -2135,8 +2140,8 @@ dict_foreign_add_to_cache(
/*************************************************************************
Scans from pointer onwards. Stops if is at the start of a copy of
'string' where characters are compared without case sensitivity. Stops
also at '\0'. */
'string' where characters are compared without case sensitivity, and
only outside `` or "" quotes. Stops also at '\0'. */
static
const char*
dict_scan_to(
@ -2145,31 +2150,34 @@ dict_scan_to(
const char* ptr, /* in: scan from */
const char* string) /* in: look for this */
{
ibool success;
ulint i;
loop:
if (*ptr == '\0') {
return(ptr);
}
success = TRUE;
for (i = 0; i < ut_strlen(string); i++) {
if (toupper((ulint)(ptr[i])) != toupper((ulint)(string[i]))) {
success = FALSE;
char quote = '\0';
for (; *ptr; ptr++) {
if (*ptr == quote) {
/* Closing quote character: do not look for
starting quote or the keyword. */
quote = '\0';
} else if (quote) {
/* Within quotes: do nothing. */
} else if (*ptr == '`' || *ptr == '"') {
/* Starting quote: remember the quote character. */
quote = *ptr;
} else {
/* Outside quotes: look for the keyword. */
ulint i;
for (i = 0; string[i]; i++) {
if (toupper((ulint)(ptr[i]))
!= toupper((ulint)(string[i]))) {
goto nomatch;
}
}
break;
nomatch:
;
}
}
if (success) {
return(ptr);
}
ptr++;
goto loop;
return(ptr);
}
/*************************************************************************
@ -2495,7 +2503,9 @@ dict_strip_comments(
char* str;
char* sptr;
char* ptr;
/* unclosed quote character (0 if none) */
char quote = 0;
str = mem_alloc(strlen(sql_string) + 1);
sptr = sql_string;
@ -2510,8 +2520,18 @@ scan_more:
return(str);
}
if (*sptr == '#'
if (*sptr == quote) {
/* Closing quote character: do not look for
starting quote or comments. */
quote = 0;
} else if (quote) {
/* Within quotes: do not look for
starting quotes or comments. */
} else if (*sptr == '"' || *sptr == '`') {
/* Starting quote: remember the quote character. */
quote = *sptr;
} else if (*sptr == '#'
|| (0 == memcmp("-- ", sptr, 3))) {
for (;;) {
/* In Unix a newline is 0x0A while in Windows
@ -2526,9 +2546,7 @@ scan_more:
sptr++;
}
}
if (*sptr == '/' && *(sptr + 1) == '*') {
} else if (!quote && *sptr == '/' && *(sptr + 1) == '*') {
for (;;) {
if (*sptr == '*' && *(sptr + 1) == '/') {
@ -2747,13 +2765,13 @@ loop:
ut_a(success);
if (!isspace(*ptr)) {
if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop;
}
do {
while (isspace(*ptr)) {
ptr++;
} while (isspace(*ptr));
}
/* read constraint name unless got "CONSTRAINT FOREIGN" */
if (ptr != ptr2) {
@ -2856,7 +2874,8 @@ col_loop1:
ut_print_name(ef, name);
fprintf(ef, " where the columns appear\n"
"as the first columns. Constraint:\n%s\n"
"See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@ -3121,7 +3140,8 @@ try_find_index:
"Cannot find an index in the referenced table where the\n"
"referenced columns appear as the first columns, or column types\n"
"in the table and the referenced table do not match for constraint.\n"
"See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);

View file

@ -19,6 +19,7 @@ Created 4/24/1996 Heikki Tuuri
#include "mach0data.h"
#include "dict0dict.h"
#include "dict0boot.h"
#include "rem0cmp.h"
/************************************************************************
Finds the first table name in the given database. */
@ -1121,12 +1122,26 @@ loop:
rec = btr_pcur_get_rec(&pcur);
field = rec_get_nth_field(rec, 0, &len);
/* Check if the table name in record is the one searched for */
if (len != ut_strlen(table_name)
|| 0 != ut_memcmp(field, table_name, len)) {
/* Check if the table name in the record is the one searched for; the
following call does the comparison in the latin1_swedish_ci
charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield),
dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) {
goto load_next_index;
}
/* Since table names in SYS_FOREIGN are stored in a case-insensitive
order, we have to check that the table name matches also in a binary
string comparison. On Unix, MySQL allows table names that only differ
in character case. */
if (0 != ut_memcmp(field, table_name, len)) {
goto next_rec;
}
if (rec_get_deleted_flag(rec)) {

View file

@ -627,7 +627,11 @@ eval_concat(
}
/*********************************************************************
Evaluates a predefined function node. */
Evaluates a predefined function node. If the first argument is an integer,
this function looks at the second argument which is the integer length in
bytes, and converts the integer to a VARCHAR.
If the first argument is of some other type, this function converts it to
BINARY. */
UNIV_INLINE
void
eval_to_binary(
@ -638,12 +642,24 @@ eval_to_binary(
que_node_t* arg2;
dfield_t* dfield;
byte* str1;
ulint len;
ulint len1;
arg1 = func_node->args;
str1 = dfield_get_data(que_node_get_val(arg1));
if (dtype_get_mtype(que_node_get_data_type(arg1)) != DATA_INT) {
len = dfield_get_len(que_node_get_val(arg1));
dfield = que_node_get_val(func_node);
dfield_set_data(dfield, str1, len);
return;
}
arg2 = que_node_get_next(arg1);
len1 = (ulint)eval_node_get_int_val(arg2);

View file

@ -2701,9 +2701,9 @@ fseg_free_page_low(
"InnoDB: database!\n", page);
crash:
fputs(
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
"InnoDB: of http://www.innodb.com/ibman.php about forcing recovery.\n",
stderr);
"InnoDB: Please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
ut_error;
}

View file

@ -566,8 +566,10 @@ dict_index_contains_col_or_prefix(
dict_index_t* index, /* in: index */
ulint n); /* in: column number */
/************************************************************************
Looks for a matching field in an index. The column and the prefix len has
to be the same. */
Looks for a matching field in an index. The column has to be the same. The
column in index must be complete, or must contain a prefix longer than the
column in index2. That is, we must be able to construct the prefix in index2
from the prefix in index. */
ulint
dict_index_get_nth_field_pos(

View file

@ -508,9 +508,11 @@ struct row_prebuilt_struct {
dtuple_t* clust_ref; /* prebuilt dtuple used in
sel/upd/del */
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
ulint stored_select_lock_type;/* inside LOCK TABLES, either
LOCK_S or LOCK_X depending on the lock
type */
ulint stored_select_lock_type;/* this field is used to
remember the original select_lock_type
that was decided in ha_innodb.cc,
::store_lock(), ::external_lock(),
etc. */
ulint mysql_row_len; /* length in bytes of a row in the
MySQL format */
ulint n_rows_fetched; /* number of rows fetched after

View file

@ -99,6 +99,7 @@ extern ibool srv_use_doublewrite_buf;
extern ibool srv_set_thread_priorities;
extern int srv_query_thread_priority;
extern ulint srv_max_purge_lag;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
@ -152,6 +153,7 @@ extern ulint srv_test_array_size;
extern ulint srv_activity_count;
extern ulint srv_fatal_semaphore_wait_threshold;
extern ulint srv_dml_needed_delay;
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
query threads, and lock table: we allocate

View file

@ -97,9 +97,11 @@ sync_arr_wake_threads_if_sema_free(void);
/**************************************************************************
Prints warnings of long semaphore waits to stderr. */
void
ibool
sync_array_print_long_waits(void);
/*=============================*/
/* out: TRUE if fatal semaphore wait threshold
was exceeded */
/************************************************************************
Validates the integrity of the wait array. Checks
that the number of reserved cells equals the count variable. */

View file

@ -419,6 +419,10 @@ struct trx_sys_struct{
trx_rseg_t* rseg_array[TRX_SYS_N_RSEGS];
/* Pointer array to rollback segments;
NULL if slot not in use */
ulint rseg_history_len;/* Length of the TRX_RSEG_HISTORY
list (update undo logs for committed
transactions), protected by
rseg->mutex */
UT_LIST_BASE_NODE_T(read_view_t) view_list;
/* List of read views sorted on trx no,
biggest first */

View file

@ -685,10 +685,9 @@ failure:
"InnoDB: To get mysqld to start up, set innodb_thread_concurrency in my.cnf\n"
"InnoDB: to a lower value, for example, to 8. After an ERROR-FREE shutdown\n"
"InnoDB: of mysqld you can adjust the size of ib_logfiles, as explained in\n"
"InnoDB: section 5 of http://www.innodb.com/ibman.php",
"InnoDB: http://dev.mysql.com/doc/mysql/en/Adding_and_removing.html\n"
"InnoDB: Cannot continue operation. Calling exit(1).\n",
(ulong)srv_thread_concurrency);
fprintf(stderr,
"InnoDB: Cannot continue operation. Calling exit(1).\n");
exit(1);
}

View file

@ -514,8 +514,8 @@ recv_find_max_checkpoint(
"InnoDB: If this error appears when you are creating an InnoDB database,\n"
"InnoDB: the problem may be that during an earlier attempt you managed\n"
"InnoDB: to create the InnoDB data files, but log file creation failed.\n"
"InnoDB: If that is the case, please refer to section 3.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php\n");
"InnoDB: If that is the case, please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n");
return(DB_ERROR);
}
@ -1840,7 +1840,7 @@ recv_report_corrupt_log(
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: If mysqld crashes after this recovery, look at\n"
"InnoDB: section 6.1 of http://www.innodb.com/ibman.php\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);

View file

@ -212,7 +212,8 @@ os_file_get_last_error(void)
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n"
"InnoDB: See http://www.innodb.com/ibman.php for installation help.\n",
"InnoDB: See http://dev.mysql.com/doc/mysql/en/InnoDB.html\n"
"InnoDB: for installation help.\n",
err);
if (err == ERROR_PATH_NOT_FOUND) {
@ -227,8 +228,9 @@ os_file_get_last_error(void)
"InnoDB: of the same name as a data file.\n");
} else {
fprintf(stderr,
"InnoDB: See section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
}
}
@ -251,7 +253,8 @@ os_file_get_last_error(void)
fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n"
"InnoDB: See http://www.innodb.com/ibman.php for installation help.\n",
"InnoDB: See http://dev.mysql.com/doc/mysql/en/InnoDB.html\n"
"InnoDB: for installation help.\n",
err);
if (err == ENOENT) {
@ -270,8 +273,9 @@ os_file_get_last_error(void)
}
fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
}
}
@ -1182,7 +1186,7 @@ os_file_pread(
os_file_n_pending_preads++;
os_mutex_exit(os_file_count_mutex);
n_bytes = pread(file, buf, n, offs);
n_bytes = pread(file, buf, (ssize_t)n, offs);
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_preads--;
@ -1207,7 +1211,7 @@ os_file_pread(
return(ret);
}
ret = read(file, buf, n);
ret = read(file, buf, (ssize_t)n);
os_mutex_exit(os_file_seek_mutexes[i]);
@ -1257,7 +1261,7 @@ os_file_pwrite(
os_file_n_pending_pwrites++;
os_mutex_exit(os_file_count_mutex);
ret = pwrite(file, buf, n, offs);
ret = pwrite(file, buf, (ssize_t)n, offs);
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_pwrites--;
@ -1292,7 +1296,7 @@ os_file_pwrite(
return(ret);
}
ret = write(file, buf, n);
ret = write(file, buf, (ssize_t)n);
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC
@ -1465,8 +1469,9 @@ retry:
fprintf(stderr,
" InnoDB: Error: File pointer positioning to file %s failed at\n"
"InnoDB: offset %lu %lu. Operating system error number %lu.\n"
"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: what the error number means.\n",
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n",
name, offset_high, offset,
(ulint)GetLastError());
@ -1523,8 +1528,9 @@ retry:
}
fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
os_has_said_disk_full = TRUE;
}
@ -1558,8 +1564,9 @@ retry:
}
fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
os_has_said_disk_full = TRUE;
}
@ -2581,6 +2588,8 @@ restart:
/* NOTE! We only access constant fields in os_aio_array. Therefore
we do not have to acquire the protecting mutex yet */
srv_set_io_thread_op_info(global_segment,
"looking for i/o requests (a)");
ut_ad(os_aio_validate());
ut_ad(segment < array->n_segments);
@ -2599,6 +2608,9 @@ restart:
os_mutex_enter(array->mutex);
srv_set_io_thread_op_info(global_segment,
"looking for i/o requests (b)");
/* Check if there is a slot for which the i/o has already been
done */
@ -2711,6 +2723,8 @@ consecutive_loop:
}
}
srv_set_io_thread_op_info(global_segment, "consecutive i/o requests");
/* We have now collected n_consecutive i/o requests in the array;
allocate a single buffer which can hold all data, and perform the
i/o */
@ -2854,6 +2868,8 @@ slot_io_done:
return(ret);
wait_for_io:
srv_set_io_thread_op_info(global_segment, "resetting wait event");
/* We wait here until there again can be i/os in the segment
of this thread */
@ -2945,9 +2961,17 @@ os_aio_print(
ulint i;
for (i = 0; i < srv_n_file_io_threads; i++) {
fprintf(file, "I/O thread %lu state: %s (%s)\n", i,
fprintf(file, "I/O thread %lu state: %s (%s)", i,
srv_io_thread_op_info[i],
srv_io_thread_function[i]);
#ifndef __WIN__
if (os_aio_segment_wait_events[i]->is_set) {
fprintf(file, " ev set");
}
#endif
fprintf(file, "\n");
}
fputs("Pending normal aio reads:", file);

View file

@ -1094,6 +1094,19 @@ opt_clust_access(
for (i = 0; i < n_fields; i++) {
pos = dict_index_get_nth_field_pos(index, clust_index, i);
ut_a(pos != ULINT_UNDEFINED);
/* We optimize here only queries to InnoDB's internal system
tables, and they should not contain column prefix indexes. */
if (dict_index_get_nth_field(index, pos)->prefix_len != 0
|| dict_index_get_nth_field(clust_index, i)
->prefix_len != 0) {
fprintf(stderr,
"InnoDB: Error in pars0opt.c: table %s has prefix_len != 0\n",
index->table_name);
}
*(plan->clust_map + i) = pos;
ut_ad((pos != ULINT_UNDEFINED)

View file

@ -259,9 +259,13 @@ pars_resolve_func_data_type(
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
} else if (func == PARS_TO_BINARY_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
} else {
dtype_set(que_node_get_data_type(node), DATA_BINARY,
0, 0, 0);
}
} else if (func == PARS_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);

View file

@ -966,6 +966,23 @@ row_ins_foreign_check_on_constraint(
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
fprintf(stderr,
"InnoDB: error: table %s has the counter 0 though there is\n"
"InnoDB: a FOREIGN KEY check running on it.\n",
foreign->foreign_table->name);
}
/* Release the data dictionary latch for a while, so that we do not
starve other threads from doing CREATE TABLE etc. if we have a huge
cascaded operation running. The counter n_foreign_key_checks_running
will prevent other users from dropping or ALTERing the table when we
release the latch. */
row_mysql_unfreeze_data_dictionary(thr_get_trx(thr));
row_mysql_freeze_data_dictionary(thr_get_trx(thr));
mtr_start(mtr);
/* Restore pcur position */

View file

@ -89,6 +89,19 @@ row_mysql_is_system_table(
|| 0 == strcmp(name + 6, "user")
|| 0 == strcmp(name + 6, "db"));
}
/***********************************************************************
Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. */
static
void
row_mysql_delay_if_needed(void)
/*===========================*/
{
if (srv_dml_needed_delay) {
os_thread_sleep(srv_dml_needed_delay);
}
}
/***********************************************************************
Reads a MySQL format variable-length field (like VARCHAR) length and
returns pointer to the field data. */
@ -310,8 +323,9 @@ handle_new_error:
"InnoDB: a case of widespread corruption, dump all InnoDB\n"
"InnoDB: tables and recreate the whole InnoDB tablespace.\n"
"InnoDB: If the mysqld server crashes after the startup or when\n"
"InnoDB: you dump the tables, look at section 6.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php for help.\n", stderr);
"InnoDB: you dump the tables, look at\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html"
" for help.\n", stderr);
} else {
fprintf(stderr, "InnoDB: unknown error code %lu\n", err);
@ -855,6 +869,8 @@ row_insert_for_mysql(
trx->op_info = (char *) "inserting";
row_mysql_delay_if_needed();
trx_start_if_not_started(trx);
if (node == NULL) {
@ -1070,6 +1086,8 @@ row_update_for_mysql(
trx->op_info = (char *) "updating or deleting";
row_mysql_delay_if_needed();
trx_start_if_not_started(trx);
node = prebuilt->upd_node;
@ -1551,8 +1569,9 @@ row_create_table_for_mysql(
"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: You can look for further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php\n", stderr);
"InnoDB: You can look for further help from\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/"
"InnoDB_troubleshooting_datadict.html\n", stderr);
}
trx->error_state = DB_SUCCESS;
@ -1962,7 +1981,8 @@ row_drop_table_for_mysql(
"WHILE found = 1 LOOP\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = table_name;\n"
" WHERE FOR_NAME = table_name\n"
" AND TO_BINARY(FOR_NAME) = TO_BINARY(table_name);\n"
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE"
@ -2049,6 +2069,7 @@ row_drop_table_for_mysql(
memcpy(sql, str1, (sizeof str1) - 1);
memcpy(sql + (sizeof str1) - 1, quoted_name, namelen);
memcpy(sql + (sizeof str1) - 1 + namelen, str2, sizeof str2);
mem_free(quoted_name);
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
@ -2089,8 +2110,9 @@ row_drop_table_for_mysql(
"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: You can look for further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php\n", stderr);
"InnoDB: You can look for further help from\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/"
"InnoDB_troubleshooting_datadict.html\n", stderr);
goto funct_exit;
}
@ -2152,8 +2174,8 @@ row_drop_table_for_mysql(
fputs(" InnoDB: You are trying to drop table ", stderr);
ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: though there are foreign key check running on it.\n"
"InnoDB: Adding the table to the background drop queue.\n",
"InnoDB: though there is a foreign key check running on it.\n"
"InnoDB: Adding the table to the background drop queue.\n",
stderr);
row_add_table_to_background_drop_list(table);
@ -2360,7 +2382,8 @@ row_rename_table_for_mysql(
"WHILE found = 1 LOOP\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = old_table_name;\n"
" WHERE FOR_NAME = old_table_name\n"
" AND TO_BINARY(FOR_NAME) = TO_BINARY(old_table_name);\n"
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE\n"
@ -2393,7 +2416,8 @@ row_rename_table_for_mysql(
" END IF;\n"
"END LOOP;\n"
"UPDATE SYS_FOREIGN SET REF_NAME = new_table_name\n"
"WHERE REF_NAME = old_table_name;\n";
"WHERE REF_NAME = old_table_name\n"
" AND TO_BINARY(REF_NAME) = TO_BINARY(old_table_name);\n";
static const char str5[] =
"END;\n";
@ -2581,15 +2605,20 @@ row_rename_table_for_mysql(
if (err == DB_DUPLICATE_KEY) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr);
fputs(
" InnoDB: Error; possible reasons:\n"
"InnoDB: 1) Table rename would cause two FOREIGN KEY constraints\n"
"InnoDB: to have the same internal name in case-insensitive comparison.\n"
"InnoDB: 2) table ", stderr);
ut_print_name(stderr, new_name);
fputs(" exists in the InnoDB internal data\n"
"InnoDB: dictionary though MySQL is trying rename table ", stderr);
ut_print_name(stderr, old_name);
fputs(" to it.\n"
"InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n"
"InnoDB: You can look for further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php\n"
"InnoDB: You can look for further help from\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/"
"InnoDB_troubleshooting_datadict.html\n"
"InnoDB: If table ", stderr);
ut_print_name(stderr, new_name);
fputs(

View file

@ -334,6 +334,7 @@ row_build_row_ref(
ulint ref_len;
ulint pos;
byte* buf;
ulint clust_col_prefix_len;
ulint i;
ut_ad(index && rec && heap);
@ -366,6 +367,22 @@ row_build_row_ref(
field = rec_get_nth_field(rec, pos, &len);
dfield_set_data(dfield, field, len);
/* If the primary key contains a column prefix, then the
secondary index may contain a longer prefix of the same
column, or the full column, and we must adjust the length
accordingly. */
clust_col_prefix_len =
dict_index_get_nth_field(clust_index, i)->prefix_len;
if (clust_col_prefix_len > 0) {
if (len != UNIV_SQL_NULL
&& len > clust_col_prefix_len) {
dfield_set_len(dfield, clust_col_prefix_len);
}
}
}
ut_ad(dtuple_check_typed(ref));
@ -396,6 +413,7 @@ row_build_row_ref_in_tuple(
ulint len;
ulint ref_len;
ulint pos;
ulint clust_col_prefix_len;
ulint i;
ut_a(ref && index && rec);
@ -433,6 +451,22 @@ row_build_row_ref_in_tuple(
field = rec_get_nth_field(rec, pos, &len);
dfield_set_data(dfield, field, len);
/* If the primary key contains a column prefix, then the
secondary index may contain a longer prefix of the same
column, or the full column, and we must adjust the length
accordingly. */
clust_col_prefix_len =
dict_index_get_nth_field(clust_index, i)->prefix_len;
if (clust_col_prefix_len > 0) {
if (len != UNIV_SQL_NULL
&& len > clust_col_prefix_len) {
dfield_set_len(dfield, clust_col_prefix_len);
}
}
}
ut_ad(dtuple_check_typed(ref));

View file

@ -58,6 +58,10 @@ ulint srv_activity_count = 0;
/* The following is the maximum allowed duration of a lock wait. */
ulint srv_fatal_semaphore_wait_threshold = 600;
/* How much data manipulation language (DML) statements need to be delayed,
in microseconds, in order to reduce the lagging of the purge thread. */
ulint srv_dml_needed_delay = 0;
ibool srv_lock_timeout_and_monitor_active = FALSE;
ibool srv_error_monitor_active = FALSE;
@ -841,6 +845,8 @@ srv_general_init(void)
/*======================= InnoDB Server FIFO queue =======================*/
/* Maximum allowable purge history length. <=0 means 'infinite'. */
ulint srv_max_purge_lag = 0;
/*************************************************************************
Puts an OS thread to wait if there are too many concurrent threads
@ -1754,7 +1760,8 @@ srv_error_monitor_thread(
/* in: a dummy parameter required by
os_thread_create */
{
ulint cnt = 0;
/* number of successive fatal timeouts observed */
ulint fatal_cnt = 0;
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Error monitor thread starts, id %lu\n",
@ -1763,8 +1770,6 @@ srv_error_monitor_thread(
loop:
srv_error_monitor_active = TRUE;
cnt++;
os_thread_sleep(2000000);
if (difftime(time(NULL), srv_last_monitor_time) > 60) {
@ -1774,7 +1779,20 @@ loop:
srv_refresh_innodb_monitor_stats();
}
sync_array_print_long_waits();
if (sync_array_print_long_waits()) {
fatal_cnt++;
if (fatal_cnt > 5) {
fprintf(stderr,
"InnoDB: Error: semaphore wait has lasted > %lu seconds\n"
"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
srv_fatal_semaphore_wait_threshold);
ut_error;
}
} else {
fatal_cnt = 0;
}
/* Flush stderr so that a database user gets the output
to possible MySQL error file */

View file

@ -61,10 +61,7 @@ struct sync_cell_struct {
thread */
ibool waiting; /* TRUE if the thread has already
called sync_array_event_wait
on this cell but not yet
sync_array_free_cell (which
actually resets wait_object and thus
whole cell) */
on this cell */
ibool event_set; /* TRUE if the event is set */
os_event_t event; /* operating system event
semaphore handle */
@ -892,15 +889,18 @@ sync_arr_wake_threads_if_sema_free(void)
/**************************************************************************
Prints warnings of long semaphore waits to stderr. */
void
ibool
sync_array_print_long_waits(void)
/*=============================*/
/* out: TRUE if fatal semaphore wait threshold
was exceeded */
{
sync_cell_t* cell;
ibool old_val;
ibool noticed = FALSE;
ulint i;
ulint fatal_timeout = srv_fatal_semaphore_wait_threshold;
ibool fatal = FALSE;
for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
@ -917,13 +917,7 @@ sync_array_print_long_waits(void)
if (cell->wait_object != NULL
&& difftime(time(NULL), cell->reservation_time)
> fatal_timeout) {
fprintf(stderr,
"InnoDB: Error: semaphore wait has lasted > %lu seconds\n"
"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
fatal_timeout);
ut_error;
fatal = TRUE;
}
}
@ -951,6 +945,8 @@ sync_array_print_long_waits(void)
fprintf(stderr,
"InnoDB: ###### Diagnostic info printed to the standard error stream\n");
}
return(fatal);
}
/**************************************************************************

View file

@ -295,6 +295,9 @@ trx_purge_add_update_undo_to_history(
/* Add the log as the first in the history list */
flst_add_first(rseg_header + TRX_RSEG_HISTORY,
undo_header + TRX_UNDO_HISTORY_NODE, mtr);
mutex_enter(&kernel_mutex);
trx_sys->rseg_history_len++;
mutex_exit(&kernel_mutex);
/* Write the trx number to the undo log header */
mlog_write_dulint(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
@ -386,6 +389,12 @@ loop:
flst_cut_end(rseg_hdr + TRX_RSEG_HISTORY,
log_hdr + TRX_UNDO_HISTORY_NODE, n_removed_logs, &mtr);
mutex_enter(&kernel_mutex);
ut_ad(trx_sys->rseg_history_len >= n_removed_logs);
trx_sys->rseg_history_len -= n_removed_logs;
mutex_exit(&kernel_mutex);
freed = FALSE;
while (!freed) {
@ -470,6 +479,11 @@ loop:
}
if (cmp >= 0) {
mutex_enter(&kernel_mutex);
ut_a(trx_sys->rseg_history_len >= n_removed_logs);
trx_sys->rseg_history_len -= n_removed_logs;
mutex_exit(&kernel_mutex);
flst_truncate_end(rseg_hdr + TRX_RSEG_HISTORY,
log_hdr + TRX_UNDO_HISTORY_NODE,
n_removed_logs, &mtr);
@ -1031,6 +1045,30 @@ trx_purge(void)
purge_sys->view = NULL;
mem_heap_empty(purge_sys->heap);
/* Determine how much data manipulation language (DML) statements
need to be delayed in order to reduce the lagging of the purge
thread. */
srv_dml_needed_delay = 0; /* in microseconds; default: no delay */
/* If we cannot advance the 'purge view' because of an old
'consistent read view', then the DML statements cannot be delayed.
Also, srv_max_purge_lag <= 0 means 'infinity'. */
if (srv_max_purge_lag > 0
&& !UT_LIST_GET_LAST(trx_sys->view_list)) {
float ratio = (float) trx_sys->rseg_history_len
/ srv_max_purge_lag;
if (ratio > ULINT_MAX / 10000) {
/* Avoid overflow: maximum delay is 4295 seconds */
srv_dml_needed_delay = ULINT_MAX;
} else if (ratio > 1) {
/* If the history list length exceeds the
innodb_max_purge_lag, the
data manipulation statements are delayed
by at least 5000 microseconds. */
srv_dml_needed_delay = (ulint) ((ratio - .5) * 10000);
}
}
purge_sys->view = read_view_oldest_copy_or_open_new(NULL,
purge_sys->heap);
mutex_exit(&kernel_mutex);

View file

@ -1257,7 +1257,7 @@ trx_undo_prev_version_build(
ibool dummy_extern;
byte* buf;
ulint err;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
@ -1367,7 +1367,18 @@ trx_undo_prev_version_build(
}
if (row_upd_changes_field_size_or_external(rec, index, update)) {
ulint* ext_vect;
ulint n_ext_vect;
/* We have to set the appropriate extern storage bits in the
old version of the record: the extern bits in rec for those
fields that update does NOT update, as well as the the bits for
those fields that update updates to become externally stored
fields. Store the info to ext_vect: */
ext_vect = mem_alloc(sizeof(ulint) * rec_get_n_fields(rec));
n_ext_vect = btr_push_update_extern_fields(ext_vect, rec,
update);
entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec,
heap);
row_upd_index_replace_new_col_vals(entry, index, update, heap);
@ -1375,6 +1386,11 @@ trx_undo_prev_version_build(
buf = mem_heap_alloc(heap, rec_get_converted_size(entry));
*old_vers = rec_convert_dtuple_to_rec(buf, entry);
/* Now set the extern bits in the old version of the record */
rec_set_field_extern_bits(*old_vers, ext_vect, n_ext_vect,
NULL);
mem_free(ext_vect);
} else {
buf = mem_heap_alloc(heap, rec_get_size(rec));
@ -1383,15 +1399,5 @@ trx_undo_prev_version_build(
row_upd_rec_in_place(*old_vers, update);
}
for (i = 0; i < upd_get_n_fields(update); i++) {
if (upd_get_nth_field(update, i)->extern_storage) {
rec_set_nth_field_extern_bit(*old_vers,
upd_get_nth_field(update, i)->field_no,
TRUE, NULL);
}
}
return(DB_SUCCESS);
}

View file

@ -135,6 +135,7 @@ trx_rseg_mem_create(
trx_ulogf_t* undo_log_hdr;
fil_addr_t node_addr;
ulint sum_of_undo_sizes;
ulint len;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
@ -166,7 +167,9 @@ trx_rseg_mem_create(
MLOG_4BYTES, mtr)
+ 1 + sum_of_undo_sizes;
if (flst_get_len(rseg_header + TRX_RSEG_HISTORY, mtr) > 0) {
len = flst_get_len(rseg_header + TRX_RSEG_HISTORY, mtr);
if (len > 0) {
trx_sys->rseg_history_len += len;
node_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_header + TRX_RSEG_HISTORY,
@ -206,6 +209,8 @@ trx_rseg_list_and_array_init(
UT_LIST_INIT(trx_sys->rseg_list);
trx_sys->rseg_history_len = 0;
for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
page_no = trx_sysf_rseg_get_page_no(sys_header, i, mtr);

View file

@ -31,8 +31,9 @@ const char* ut_dbg_msg_trap =
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
"InnoDB: If you get repeated assertion failures or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php about forcing recovery.\n";
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n";
const char* ut_dbg_msg_stop =
"InnoDB: Thread %lu stopped in file %s line %lu\n";

View file

@ -670,7 +670,7 @@ static void get_options(register int *argc, register char ***argv)
if (isatty(fileno(stdout)))
testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc == 0)

View file

@ -353,7 +353,7 @@ static void get_options(int *argc, char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
my_progname= argv[0][0];

View file

@ -31,7 +31,7 @@ include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
EXTRA_DIST = Makefile.shared
EXTRA_DIST = Makefile.shared libmysql.def
# This is called from the toplevel makefile
link_sources:

View file

@ -3153,6 +3153,41 @@ void my_net_local_init(NET *net)
net->max_packet_size= max(net_buffer_length, max_allowed_packet);
}
/*
This function is used to create HEX string that you
can use in a SQL statement in of the either ways:
INSERT INTO blob_column VALUES (0xAABBCC); (any MySQL version)
INSERT INTO blob_column VALUES (X'AABBCC'); (4.1 and higher)
The string in "from" is encoded to a HEX string.
The result is placed in "to" and a terminating null byte is appended.
The string pointed to by "from" must be "length" bytes long.
You must allocate the "to" buffer to be at least length*2+1 bytes long.
Each character needs two bytes, and you need room for the terminating
null byte. When mysql_hex_string() returns, the contents of "to" will
be a null-terminated string. The return value is the length of the
encoded string, not including the terminating null character.
The return value does not contain any leading 0x or a leading X' and
trailing '. The caller must supply whichever of those is desired.
*/
ulong STDCALL
mysql_hex_string(char *to, const char *from, ulong length)
{
char *to0= to;
const char *end;
for (end= from + length; from < end; from++)
{
*to++= _dig_vec[((unsigned char) *from) >> 4];
*to++= _dig_vec[((unsigned char) *from) & 0x0F];
}
*to= '\0';
return (ulong) (to-to0);
}
/*
Add escape characters to a string (blob?) to make it suitable for a insert
to should at least have place for length*2+1 chars

View file

@ -11,6 +11,7 @@ EXPORTS
mysql_errno
mysql_error
mysql_escape_string
mysql_hex_string
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields

View file

@ -51,6 +51,9 @@ fi
# libtool 1.4.2 workaround
SED=${SED:-sed}
# workaround against unset 'max_cmd_len': assume at least 4 kB
max_cmd_len=${max_cmd_len:-4096}
# The name of this program.
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
modename="$progname"

View file

@ -161,7 +161,7 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
if (param.trunc) ftbw->flags|=FTB_FLAG_TRUNC;
ftbw->weight=weight;
ftbw->up=up;
ftbw->docid[0]=ftbw->docid[1]=HA_POS_ERROR;
ftbw->docid[0]=ftbw->docid[1]=HA_OFFSET_ERROR;
ftbw->ndepth= (param.yesno<0) + depth;
memcpy(ftbw->word+1, w.pos, w.len);
ftbw->word[0]=w.len;
@ -177,7 +177,7 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
ftbe->weight=weight;
ftbe->up=up;
ftbe->ythresh=ftbe->yweaks=0;
ftbe->docid[0]=ftbe->docid[1]=HA_POS_ERROR;
ftbe->docid[0]=ftbe->docid[1]=HA_OFFSET_ERROR;
if ((ftbe->quot=param.quot)) ftb->with_scan|=2;
if (param.yesno > 0) up->ythresh++;
_ftb_parse_query(ftb, start, end, ftbe, depth+1);
@ -245,9 +245,9 @@ static void _ftb_init_index_search(FT_INFO *ftb)
ftbe->up->ythresh - ftbe->up->yweaks >1) /* 1 */
{
FTB_EXPR *top_ftbe=ftbe->up->up;
ftbw->docid[0]=HA_POS_ERROR;
ftbw->docid[0]=HA_OFFSET_ERROR;
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
if (ftbe->flags & FTB_FLAG_YES)
if (!(ftbe->flags & FTB_FLAG_NO))
ftbe->yweaks++;
ftbe=0;
break;
@ -255,7 +255,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
}
if (!ftbe)
continue;
/* 3 */
/* 4 */
if (!is_tree_inited(& ftb->no_dupes))
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
_ftb_no_dupes_cmp,0,0,0);
@ -319,7 +319,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=HA_POS_ERROR;
ftb->lastpos=HA_OFFSET_ERROR;
bzero(& ftb->no_dupes, sizeof(TREE));
init_alloc_root(&ftb->mem_root, 1024, 1024);
@ -342,7 +342,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftbe->quot=0;
ftbe->up=0;
ftbe->ythresh=ftbe->yweaks=0;
ftbe->docid[0]=ftbe->docid[1]=HA_POS_ERROR;
ftbe->docid[0]=ftbe->docid[1]=HA_OFFSET_ERROR;
ftb->root=ftbe;
_ftb_parse_query(ftb, &query, query+query_len, ftbe, 0);
ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root,
@ -496,7 +496,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
while (ftb->state == INDEX_SEARCH &&
(curdoc=((FTB_WORD *)queue_top(& ftb->queue))->docid[0]) !=
HA_POS_ERROR)
HA_OFFSET_ERROR)
{
while (curdoc==(ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid[0])
{
@ -521,7 +521,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
}
if (r) /* not found */
{
ftbw->docid[0]=HA_POS_ERROR;
ftbw->docid[0]=HA_OFFSET_ERROR;
if (ftbw->flags&FTB_FLAG_YES && ftbw->up->up==0)
{
/*
@ -580,7 +580,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
const byte *end;
my_off_t docid=ftb->info->lastpos;
if (docid == HA_POS_ERROR)
if (docid == HA_OFFSET_ERROR)
return -2.0;
if (!ftb->queue.elements)
return 0;
@ -592,9 +592,9 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
for (i=0; i < ftb->queue.elements; i++)
{
ftb->list[i]->docid[1]=HA_POS_ERROR;
ftb->list[i]->docid[1]=HA_OFFSET_ERROR;
for (x=ftb->list[i]->up; x; x=x->up)
x->docid[1]=HA_POS_ERROR;
x->docid[1]=HA_OFFSET_ERROR;
}
}

View file

@ -3520,7 +3520,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
create_info.raid_chunksize= share.base.raid_chunksize;
create_info.language = (param->language ? param->language :
share.state.header.language);
create_info.key_file_length= status_info.key_file_length;
/* We don't have to handle symlinks here because we are using
HA_DONT_TOUCH_DATA */
if (mi_create(filename,

View file

@ -70,6 +70,12 @@ int mi_close(register MI_INFO *info)
error=my_errno;
if (share->kfile >= 0)
{
/*
If we are crashed, we can safely flush the current state as it will
not change the crashed state.
We can NOT write the state in other cases as other threads
may be using the file at this point
*/
if (share->mode != O_RDONLY && mi_is_crashed(info))
mi_state_info_write(share->kfile, &share->state, 1);
if (my_close(share->kfile,MYF(0)))

View file

@ -46,7 +46,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
ulong reclength, real_reclength,min_pack_length;
char filename[FN_REFLEN],linkname[FN_REFLEN], *linkname_ptr;
ulong pack_reclength;
ulonglong tot_length,max_rows;
ulonglong tot_length,max_rows, tmp;
enum en_fieldtype type;
MYISAM_SHARE share;
MI_KEYDEF *keydef,tmp_keydef;
@ -442,10 +442,15 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
share.state.auto_increment=ci->auto_increment;
share.options=options;
share.base.rec_reflength=pointer;
/* Get estimate for index file length (this may be wrong for FT keys) */
tmp= (tot_length + max_key_block_length * keys *
MI_INDEX_BLOCK_MARGIN) / MI_MIN_KEY_BLOCK_LENGTH;
/*
use maximum of key_file_length we calculated and key_file_length value we
got from MYI file header (see also myisampack.c:save_state)
*/
share.base.key_reflength=
mi_get_pointer_length((tot_length + max_key_block_length * keys *
MI_INDEX_BLOCK_MARGIN) / MI_MIN_KEY_BLOCK_LENGTH,
3);
mi_get_pointer_length(max(ci->key_file_length,tmp),3);
share.base.keys= share.state.header.keys = keys;
share.state.header.uniques= uniques;
mi_int2store(share.state.header.key_parts,key_segs);

View file

@ -19,7 +19,7 @@
reads info from a isam-table. Must be first request before doing any furter
calls to any isamfunktion. Is used to allow many process use the same
isamdatabase.
*/
*/
#include "myisamdef.h"
#ifdef __WIN__
@ -35,12 +35,17 @@ int mi_lock_database(MI_INFO *info, int lock_type)
MYISAM_SHARE *share=info->s;
uint flag;
DBUG_ENTER("mi_lock_database");
DBUG_PRINT("info",("lock_type: %d", lock_type));
DBUG_PRINT("enter",("lock_type: %d old lock %d r_locks: %u w_locks: %u "
"global_changed: %d open_count: %u name: '%s'",
lock_type, info->lock_type, share->r_locks,
share->w_locks,
share->global_changed, share->state.open_count,
share->index_file_name));
if (share->options & HA_OPTION_READ_ONLY_DATA ||
info->lock_type == lock_type)
DBUG_RETURN(0);
if (lock_type == F_EXTRA_LCK)
if (lock_type == F_EXTRA_LCK) /* Used by TMP tables */
{
++share->w_locks;
++share->tot_locks;
@ -54,7 +59,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
switch (lock_type) {
case F_UNLCK:
DBUG_PRINT("info", ("old lock: %d", info->lock_type));
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
else
@ -83,7 +87,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
share->state.process= share->last_process=share->this_process;
share->state.unique= info->last_unique= info->this_unique;
share->state.update_count= info->last_loop= ++info->this_loop;
if (mi_state_info_write(share->kfile, &share->state, 1))
if (mi_state_info_write(share->kfile, &share->state, 1))
error=my_errno;
share->changed=0;
if (myisam_flush)
@ -121,11 +125,17 @@ int mi_lock_database(MI_INFO *info, int lock_type)
break;
case F_RDLCK:
if (info->lock_type == F_WRLCK)
{ /* Change RW to READONLY */
{
/*
Change RW to READONLY
mysqld does not turn write locks to read locks,
so we're never here in mysqld.
*/
if (share->w_locks == 1)
{
flag=1;
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
MYF(MY_SEEK_NOT_DONE)))
{
error=my_errno;
@ -333,9 +343,10 @@ int _mi_readinfo(register MI_INFO *info, int lock_type, int check_keybuffer)
} /* _mi_readinfo */
/* Every isam-function that uppdates the isam-database must! end */
/* with this request */
/* ARGSUSED */
/*
Every isam-function that uppdates the isam-database MUST end with this
request
*/
int _mi_writeinfo(register MI_INFO *info, uint operation)
{
@ -402,12 +413,31 @@ int _mi_test_if_changed(register MI_INFO *info)
} /* _mi_test_if_changed */
/* Put a mark in the .MYI file that someone is updating the table */
/*
Put a mark in the .MYI file that someone is updating the table
DOCUMENTATION
state.open_count in the .MYI file is used the following way:
- For the first change of the .MYI file in this process open_count is
incremented by mi_mark_file_change(). (We have a write lock on the file
when this happens)
- In mi_close() it's decremented by _mi_decrement_open_count() if it
was incremented in the same process.
This mean that if we are the only process using the file, the open_count
tells us if the MYISAM file wasn't properly closed. (This is true if
my_disable_locking is set).
*/
int _mi_mark_file_changed(MI_INFO *info)
{
char buff[3];
register MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_mark_file_changed");
if (!(share->state.changed & STATE_CHANGED) || ! share->global_changed)
{
share->state.changed|=(STATE_CHANGED | STATE_NOT_ANALYZED |
@ -421,12 +451,12 @@ int _mi_mark_file_changed(MI_INFO *info)
{
mi_int2store(buff,share->state.open_count);
buff[2]=1; /* Mark that it's changed */
return (my_pwrite(share->kfile,buff,sizeof(buff),
sizeof(share->state.header),
MYF(MY_NABP)));
DBUG_RETURN(my_pwrite(share->kfile,buff,sizeof(buff),
sizeof(share->state.header),
MYF(MY_NABP)));
}
}
return 0;
DBUG_RETURN(0);
}

View file

@ -188,7 +188,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->state_diff_length=len-MI_STATE_INFO_SIZE;
if (share->state.header.fulltext_keys)
{
fprintf(stderr, "Warning: table file %s was created in MySQL 4.1+, use REPAIR TABLE ... USE_FRM to recreate it as a valid MySQL 4.0 table\n", name_buff);
my_errno=HA_ERR_UNSUPPORTED;
goto err;
}
mi_state_info_read(disk_cache, &share->state);
len= mi_uint2korr(share->state.header.base_info_length);

View file

@ -643,7 +643,7 @@ static void get_options(int argc, char *argv[])
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return;

View file

@ -66,7 +66,7 @@ int main(int argc,char *argv[])
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
MY_INIT(argv[0]);
if (error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))
if (error=handle_options(&argc, &argv, my_long_options, get_one_option))
exit(error);
if (count || dump)
verbose=0;

View file

@ -677,7 +677,7 @@ static void get_options(register int *argc,register char ***argv)
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */

View file

@ -111,6 +111,8 @@ typedef struct st_isam_mrg {
uint ref_length;
uint max_blob_length;
my_off_t records;
/* true if at least one source file has at least one disabled index */
my_bool src_file_has_indexes_disabled;
} PACK_MRG_INFO;
@ -350,7 +352,7 @@ static void get_options(int *argc,char ***argv)
if (isatty(fileno(stdout)))
write_loop=1;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (!*argc)
@ -413,10 +415,15 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
mrg->current=0;
mrg->file=(MI_INFO**) my_malloc(sizeof(MI_INFO*)*count,MYF(MY_FAE));
mrg->free_file=1;
mrg->src_file_has_indexes_disabled= 0;
for (i=0; i < count ; i++)
{
if (!(mrg->file[i]=open_isam_file(names[i],O_RDONLY)))
goto error;
mrg->src_file_has_indexes_disabled|= ((mrg->file[i]->s->state.key_map !=
(((ulonglong) 1) <<
mrg->file[i]->s->base. keys) - 1));
}
/* Check that files are identical */
for (j=0 ; j < count-1 ; j++)
@ -2040,8 +2047,21 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
share->state.dellink= HA_OFFSET_ERROR;
share->state.split=(ha_rows) mrg->records;
share->state.version=(ulong) time((time_t*) 0);
if (share->state.key_map != (((ulonglong)1) << share->base.keys) - 1)
{
/*
Some indexes are disabled, cannot use current key_file_length value
as an estimate of upper bound of index file size. Use packed data file
size instead.
*/
share->state.state.key_file_length= new_length;
}
/*
If there are no disabled indexes, keep key_file_length value from
original file so "myisamchk -rq" can use this value (this is necessary
because index size cannot be easily calculated for fulltext keys)
*/
share->state.key_map=0;
share->state.state.key_file_length=share->base.keystart;
for (key=0 ; key < share->base.keys ; key++)
share->state.key_root[key]= HA_OFFSET_ERROR;
for (key=0 ; key < share->state.header.max_block_size ; key++)
@ -2050,8 +2070,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
share->changed=1; /* Force write of header */
share->state.open_count=0;
share->global_changed=0;
VOID(my_chsize(share->kfile, share->state.state.key_file_length, 0,
MYF(0)));
VOID(my_chsize(share->kfile, share->base.keystart, 0, MYF(0)));
if (share->base.keys)
isamchk_neaded=1;
DBUG_RETURN(mi_state_info_write(share->kfile,&share->state,1+2));
@ -2074,7 +2093,12 @@ static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length,
state.state.del=0;
state.state.empty=0;
state.state.records=state.split=(ha_rows) mrg->records;
state.state.key_file_length=isam_file->s->base.keystart;
/* See comment above in save_state about key_file_length handling. */
if (mrg->src_file_has_indexes_disabled)
{
isam_file->s->state.state.key_file_length=
max(isam_file->s->state.state.key_file_length, new_length);
}
state.dellink= HA_OFFSET_ERROR;
state.version=(ulong) time((time_t*) 0);
state.key_map=0;

View file

@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
int save_errno,errpos=0;
uint files=0,i,dir_length,length,key_parts;
ulonglong file_offset;
ulonglong file_offset=0;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO *m_info=0;
File fd;
IO_CACHE file;
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
bzero((char*) &file,sizeof(file));
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))) < 0)
@ -69,10 +72,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
continue; /* Skip empty lines */
if (buff[0] == '#')
{
if( !strncmp(buff+1,"INSERT_METHOD=",14))
if (!strncmp(buff+1,"INSERT_METHOD=",14))
{ /* Lookup insert method */
int tmp=find_type(buff+15,&merge_insert_method,2);
m_info->merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
}
continue; /* Skip comments */
}
@ -84,8 +87,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
VOID(cleanup_dirname(buff,name_buff));
}
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
goto err;
if (!m_info)
goto err;
if (!m_info) /* First file */
{
key_parts=isam->s->base.key_parts;
if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) +
@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
m_info->open_tables=(MYRG_TABLE *) (m_info+1);
m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files);
m_info->tables= files;
files= 0;
}
else
{
m_info->open_tables=0;
m_info->rec_per_key_part=0;
}
m_info->tables=files;
m_info->reclength=isam->s->base.reclength;
file_offset=files=0;
errpos=3;
}
m_info->open_tables[files].table= isam;
@ -122,14 +120,16 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->del+= isam->state->del;
m_info->data_file_length+= isam->state->data_file_length;
for (i=0; i < key_parts; i++)
m_info->rec_per_key_part[i]+=isam->s->state.rec_per_key_part[i] / m_info->tables;
m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] /
m_info->tables);
}
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME|MY_ZEROFILL))))
MYF(MY_WME | MY_ZEROFILL))))
goto err;
/* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */
m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA);
m_info->merge_insert_method= found_merge_insert_method;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
{

View file

@ -32,6 +32,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
install-data-local:
$(mkinstalldirs) \
@ -50,6 +51,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
SUFFIXES = .sh

View file

@ -267,3 +267,18 @@ select * from t1 where word like CAST(0xDF as CHAR);
word word2
ß ß
drop table t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
autor varchar(80) NOT NULL default '',
PRIMARY KEY (autor)
);
INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'),
('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'),
('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
autor
Pozzi, S(amuel-Jean).
Pozzi, Samuel-Jean.
Pozzo, A.
Pozzoli, Serge.
DROP TABLE t1;

View file

@ -50,3 +50,14 @@ select count(*) from t1;
count(*)
0
drop table t1;
create table t1 (a int not null auto_increment primary key, b char(32));
insert into t1 (b) values ('apple'), ('apple');
select * from t1;
a b
1 apple
2 apple
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
select * from t1;
a b
1 apple
drop table t1;

View file

@ -7,58 +7,6 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
drop database if exists test_test;
create database test_test;
use test_test;
create table t1(table_id char(20) primary key);
insert into t1 values ('test_test.t1');
insert into t1 values ('');
handler t1 open;
handler t1 read first limit 9;
table_id
test_test.t1
create table t2(table_id char(20) primary key);
insert into t2 values ('test_test.t2');
insert into t2 values ('');
handler t2 open;
handler t2 read first limit 9;
table_id
test_test.t2
use test;
drop table if exists t1;
create table t1(table_id char(20) primary key);
insert into t1 values ('test.t1');
insert into t1 values ('');
handler t1 open;
handler t1 read first limit 9;
table_id
test.t1
use test;
handler test.t1 read first limit 9;
table_id
test.t1
handler test.t2 read first limit 9;
Unknown table 't2' in HANDLER
handler test_test.t1 read first limit 9;
table_id
test_test.t1
handler test_test.t2 read first limit 9;
table_id
test_test.t2
handler test_test.t1 close;
drop table test_test.t1;
handler test_test.t2 close;
drop table test_test.t2;
drop database test_test;
use test;
handler test.t1 close;
drop table test.t1;
drop table if exists t1;
drop table if exists t2;
create table t1(table_id char(20) primary key);
@ -84,14 +32,23 @@ test.t2
flush tables;
handler a1 read first limit 9;
Unknown table 'a1' in HANDLER
table_id
test.t1
handler a2 read first limit 9;
Unknown table 'a2' in HANDLER
table_id
test.t1
handler t2 read first limit 9;
Unknown table 't2' in HANDLER
table_id
test.t2
handler t1 open as a1;
Not unique table/alias: 'a1'
handler t1 open as a2;
Not unique table/alias: 'a2'
handler t2 open;
Not unique table/alias: 't2'
handler a1 read first limit 9;
table_id
test.t1
@ -106,15 +63,43 @@ test.t2
flush table t1;
handler a1 read first limit 9;
Unknown table 'a1' in HANDLER
table_id
test.t1
handler a2 read first limit 9;
Unknown table 'a2' in HANDLER
table_id
test.t1
handler t2 read first limit 9;
table_id
test.t2
flush table t2;
handler t2 close;
Unknown table 't2' in HANDLER
drop table t1;
drop table t2;
create table t1(table_id char(20) primary key);
insert into t1 values ('Record-01');
insert into t1 values ('Record-02');
insert into t1 values ('Record-03');
insert into t1 values ('Record-04');
insert into t1 values ('Record-05');
handler t1 open;
handler t1 read first limit 1;
table_id
Record-01
handler t1 read next limit 1;
table_id
Record-02
handler t1 read next limit 1;
table_id
Record-03
flush table t1;
handler t1 read next limit 1;
table_id
Record-01
handler t1 read next limit 1;
table_id
Record-02
handler t1 close;
drop table t1;

View file

@ -162,6 +162,14 @@ a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
a
aaa10 bbb20
select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
a
aaa20 bbb15
aaa30 bbb10
select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
a
aaa20 bbb15
aaa30 bbb10
drop table t1;
CREATE TABLE t1 (
id int(11),
@ -298,3 +306,12 @@ t1_id name t2_id t1_id name
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
t2_id t1_id name
drop table t1,t2;
CREATE TABLE t1 (h text, FULLTEXT (h));
INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
select count(*) from t1;
count(*)
1
drop table t1;

View file

@ -64,3 +64,6 @@ select if(1>2,a,avg(a)) from t1;
if(1>2,a,avg(a))
1.5000
drop table t1;
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL
1 0

View file

@ -167,6 +167,9 @@ length(quote(concat(char(0),"test")))
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
27E0E3E6E7E8EAEB27
select concat('a', quote(NULL));
concat('a', quote(NULL))
aNULL
select reverse("");
reverse("")
@ -278,7 +281,13 @@ insert into t1 values ('one'),(NULL),('two'),('four');
select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1;
a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n')
one 'one' 0 0 'one'
NULL NULL 1 1 n
NULL NULL 0 0 NULL
two 'two' 0 0 'two'
four 'four' 0 0 'four'
drop table t1;
select trim(trailing 'foo' from 'foo');
trim(trailing 'foo' from 'foo')
select trim(leading 'foo' from 'foo');
trim(leading 'foo' from 'foo')

View file

@ -470,3 +470,9 @@ unix_timestamp(@a)
select unix_timestamp('1969-12-01 19:00:01');
unix_timestamp('1969-12-01 19:00:01')
0
select from_unixtime(0);
from_unixtime(0)
NULL
select from_unixtime(2145916800);
from_unixtime(2145916800)
NULL

View file

@ -150,3 +150,9 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
create database db6123;
grant usage on db6123.* to test6123 identified by 'magic123';
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
host db user select_priv insert_priv
delete from mysql.user where user='test6123';
drop database db6123;

View file

@ -203,3 +203,247 @@ handler t1 read a=(1) where b=1;
a b
handler t1 close;
drop table t1;
drop database if exists test_test;
create database test_test;
use test_test;
create table t1(table_id char(20) primary key);
insert into t1 values ('test_test.t1');
insert into t1 values ('');
handler t1 open;
handler t1 read first limit 9;
table_id
test_test.t1
create table t2(table_id char(20) primary key);
insert into t2 values ('test_test.t2');
insert into t2 values ('');
handler t2 open;
handler t2 read first limit 9;
table_id
test_test.t2
use test;
drop table if exists t1;
create table t1(table_id char(20) primary key);
insert into t1 values ('test.t1');
insert into t1 values ('');
handler t1 open;
Not unique table/alias: 't1'
use test;
handler test.t1 read first limit 9;
Unknown table 'test.t1' in HANDLER
handler test_test.t1 read first limit 9;
table_id
test_test.t1
handler t1 read first limit 9;
table_id
test_test.t1
handler test_test.t2 read first limit 9;
table_id
test_test.t2
handler t2 read first limit 9;
table_id
test_test.t2
handler test_test.t1 close;
handler t1 close;
Unknown table 't1' in HANDLER
drop table test_test.t1;
handler test_test.t2 close;
handler t2 close;
Unknown table 't2' in HANDLER
drop table test_test.t2;
drop database test_test;
use test;
handler test.t1 close;
Unknown table 'test.t1' in HANDLER
handler t1 close;
Unknown table 't1' in HANDLER
drop table test.t1;
drop database if exists test_test;
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
create database test_test;
use test_test;
create table t1 (c1 char(20));
insert into t1 values ('test_test.t1');
create table t3 (c1 char(20));
insert into t3 values ('test_test.t3');
handler t1 open;
handler t1 read first limit 9;
c1
test_test.t1
handler t1 open h1;
handler h1 read first limit 9;
c1
test_test.t1
use test;
create table t1 (c1 char(20));
create table t2 (c1 char(20));
create table t3 (c1 char(20));
insert into t1 values ('t1');
insert into t2 values ('t2');
insert into t3 values ('t3');
handler t1 open;
Not unique table/alias: 't1'
handler t2 open t1;
Not unique table/alias: 't1'
handler t3 open t1;
Not unique table/alias: 't1'
handler t1 read first limit 9;
c1
test_test.t1
handler test.t1 close;
Unknown table 'test.t1' in HANDLER
handler test.t1 open h1;
Not unique table/alias: 'h1'
handler test_test.t1 open h1;
Not unique table/alias: 'h1'
handler test_test.t3 open h3;
handler test.t1 open h2;
handler t1 read first limit 9;
c1
test_test.t1
handler h1 read first limit 9;
c1
test_test.t1
handler h2 read first limit 9;
c1
t1
handler h3 read first limit 9;
c1
test_test.t3
handler test.h2 read first limit 9;
c1
t1
handler test.h1 close;
Unknown table 'test.h1' in HANDLER
handler test_test.t1 close;
handler test_test.h1 close;
handler h2 close;
handler t1 read first limit 9;
Unknown table 't1' in HANDLER
handler h1 read first limit 9;
Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
Unknown table 'h2' in HANDLER
handler h3 read first limit 9;
c1
test_test.t3
handler test_test.h3 read first limit 9;
c1
test_test.t3
use test_test;
handler h3 read first limit 9;
c1
test_test.t3
handler test.h3 read first limit 9;
Unknown table 'test.h3' in HANDLER
handler test_test.h3 close;
use test;
drop table t3;
drop table t2;
drop table t1;
drop database test_test;
create table t1 (c1 char(20));
insert into t1 values ("t1");
handler t1 open as h1;
handler h1 read first limit 9;
c1
t1
create table t2 (c1 char(20));
insert into t2 values ("t2");
handler t2 open as h2;
handler h2 read first limit 9;
c1
t2
create table t3 (c1 char(20));
insert into t3 values ("t3");
handler t3 open as h3;
handler h3 read first limit 9;
c1
t3
create table t4 (c1 char(20));
insert into t4 values ("t4");
handler t4 open as h4;
handler h4 read first limit 9;
c1
t4
create table t5 (c1 char(20));
insert into t5 values ("t5");
handler t5 open as h5;
handler h5 read first limit 9;
c1
t5
alter table t1 engine=MyISAM;
handler h1 read first limit 9;
Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
c1
t2
handler h3 read first limit 9;
c1
t3
handler h4 read first limit 9;
c1
t4
handler h5 read first limit 9;
c1
t5
alter table t5 engine=MyISAM;
handler h1 read first limit 9;
Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
c1
t2
handler h3 read first limit 9;
c1
t3
handler h4 read first limit 9;
c1
t4
handler h5 read first limit 9;
Unknown table 'h5' in HANDLER
alter table t3 engine=MyISAM;
handler h1 read first limit 9;
Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
c1
t2
handler h3 read first limit 9;
Unknown table 'h3' in HANDLER
handler h4 read first limit 9;
c1
t4
handler h5 read first limit 9;
Unknown table 'h5' in HANDLER
handler h2 close;
handler h4 close;
handler t1 open as h1_1;
handler t1 open as h1_2;
handler t1 open as h1_3;
handler h1_1 read first limit 9;
c1
t1
handler h1_2 read first limit 9;
c1
t1
handler h1_3 read first limit 9;
c1
t1
alter table t1 engine=MyISAM;
handler h1_1 read first limit 9;
Unknown table 'h1_1' in HANDLER
handler h1_2 read first limit 9;
Unknown table 'h1_2' in HANDLER
handler h1_3 read first limit 9;
Unknown table 'h1_3' in HANDLER
drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table t5;

View file

@ -0,0 +1,2 @@
from_unixtime(1072904422)
2004-01-01 00:00:00

View file

@ -1,4 +1,9 @@
set global innodb_table_locks=1;
select @@innodb_table_locks;
@@innodb_table_locks
1
drop table if exists t1;
set @@innodb_table_locks=1;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
@ -20,3 +25,33 @@ id x
0 2
commit;
drop table t1;
set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2);
commit;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
set autocommit=0;
set @@innodb_table_locks=0;
lock table t1 write;
update t1 set x=10 where id = 2;
SELECT * from t1 where id = 2;
id x
2 2
UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
id x
0 0
1 1
2 3
commit;
unlock tables;
commit;
select * from t1;
id x
0 0
1 1
2 10
drop table t1;

View file

@ -13,7 +13,7 @@ t1
AB%
describe select * from t1 where t1="ABC";
table type possible_keys key key_len ref rows Extra
t1 const PRIMARY PRIMARY 3 const 1
t1 const PRIMARY PRIMARY 3 const 1 Using index
describe select * from t1 where t1="ABCD";
Comment
Impossible WHERE noticed after reading const tables

View file

@ -17,6 +17,18 @@ unlock tables;
n
1
drop table t1;
create table t1 (a int, b int);
create table t2 (c int, d int);
insert into t1 values(1,1);
insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
update t1,t2 set c=a where b=d;
select c from t2;
c
2
drop table t1;
drop table t2;
create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;

View file

@ -610,3 +610,12 @@ x y
1 3
1 2
drop table t1,t2,t3;
create table t1 (a int);
create table t2 (a int);
insert into t1 values (0);
insert into t2 values (1);
create table t3 engine=merge union=(t1, t2) select * from t1;
INSERT TABLE 't1' isn't allowed in FROM table list
create table t3 engine=merge union=(t1, t2) select * from t2;
INSERT TABLE 't2' isn't allowed in FROM table list
drop table t1, t2;

View file

@ -177,4 +177,25 @@ master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use `test`; insert into t1 values(16)
master-bin.001 179 Query 1 79 use `test`; insert into t1 values(18)
master-bin.001 239 Query 1 239 use `test`; COMMIT
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
insert into t1 values (1);
begin;
select * from t1 for update;
a
1
select (@before:=unix_timestamp())*0;
(@before:=unix_timestamp())*0
0
begin;
select * from t1 for update;
insert into t2 values (20);
Lock wait timeout exceeded; Try restarting transaction
select (@after:=unix_timestamp())*0;
(@after:=unix_timestamp())*0
0
select (@after-@before) >= 2;
(@after-@before) >= 2
1
drop table t1,t2;

View file

@ -151,7 +151,6 @@ Table 't2' was locked with a READ lock and can't be updated
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
Table 't2' was locked with a READ lock and can't be updated
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
Table 't2' was locked with a READ lock and can't be updated
unlock tables;
LOCK TABLES t1 write, t2 write;
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;

View file

@ -12,7 +12,7 @@ table type possible_keys key key_len ref rows Extra
t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
table type possible_keys key key_len ref rows Extra
t1 const a,b a 9 const,const 1
t1 const a,b a 9 const,const 1 Using index
explain select * from t1 where a<=>b limit 2;
table type possible_keys key key_len ref rows Extra
t1 index NULL a 9 NULL 12 Using where; Using index

View file

@ -704,4 +704,17 @@ Qcache_queries_in_cache 1
unlock table;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
CREATE TABLE t1 (id INT PRIMARY KEY);
insert into t1 values (1),(2),(3);
select * from t1;
id
1
2
3
create temporary table t1 (a int not null auto_increment
primary key);
select * from t1;
a
drop table t1;
drop table t1;
set GLOBAL query_cache_size=0;

View file

@ -0,0 +1,13 @@
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;
create table t1 (a int) type=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
commit;
unlock tables;
drop table t1;

View file

@ -0,0 +1,51 @@
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 database if exists mysqltest1;
create database mysqltest1 /*!40100 character set latin2 */;
use mysqltest1;
drop table if exists t1;
create table t1 (a varchar(255) character set latin2, b varchar(4));
SET CHARACTER SET cp1250_latin2;
INSERT INTO t1 VALUES ('ŠŒ<C5A0>Ž<EFBFBD>','80');
INSERT INTO t1 VALUES ('šœ<C5A1>žŸ','90');
INSERT INTO t1 VALUES ('£¥ª¯','A0');
INSERT INTO t1 VALUES ('³¹º¼¾¿','B0');
INSERT INTO t1 VALUES ('ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ','C0');
INSERT INTO t1 VALUES ('ÐÑÒÓÔÕÖרÙÚÛÜÝÞß','D0');
INSERT INTO t1 VALUES ('àáâãäåæçèéêëìíîï','E0');
INSERT INTO t1 VALUES ('ðñòóôõö÷øùúûüýþÿ','F0');
select "--- on master ---";
--- on master ---
--- on master ---
select hex(a),b from t1 order by b;
hex(a) b
A9A6ABAEAC 80
B9B6BBBEBC 90
A3A1AAAF A0
B3B1BAA5B5BF B0
C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
show binlog events from 1979;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 1979 Query 1 1979 use `mysqltest1`; SET CHARACTER SET DEFAULT
use mysqltest1;
select "--- on slave ---";
--- on slave ---
--- on slave ---
select hex(a),b from t1 order by b;
hex(a) b
A9A6ABAEAC 80
B9B6BBBEBC 90
A3A1AAAF A0
B3B1BAA5B5BF B0
C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
drop database mysqltest1;

View file

@ -2327,6 +2327,22 @@ select * from t2,t3 where t2.s = t3.s;
s s
two two
drop table t1, t2, t3;
CREATE TABLE t1 (
i int(11) NOT NULL default '0',
c char(10) NOT NULL default '',
PRIMARY KEY (i),
UNIQUE KEY c (c)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 VALUES (2,'b');
INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
table type possible_keys key key_len ref rows Extra
t1 const PRIMARY PRIMARY 4 const 1 Using index
EXPLAIN SELECT i FROM t1 WHERE i=1;
table type possible_keys key key_len ref rows Extra
t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1;
create table t1 (a integer, b integer, index(a), index(b));
create table t2 (c integer, d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);

View file

@ -0,0 +1,41 @@
drop table if exists t1;
create table t1 (i int, c varchar(20));
insert into t1 values
(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
insert into t1 values
(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
insert into t1 values
(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
insert into t1 values
(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
select i, from_unixtime(i), c from t1;
i from_unixtime(i) c
1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
1080428421 2004-03-28 01:59:59 2004-03-28 01:59:59
1080428422 2004-03-28 03:00:00 2004-03-28 02:30:00
1080428422 2004-03-28 03:00:00 2004-03-28 03:00:00
1083355222 2004-05-01 00:00:00 2004-05-01 00:00:00
1099170022 2004-10-31 01:00:00 2004-10-31 01:00:00
1099177222 2004-10-31 02:00:00 2004-10-31 02:00:00
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
1099184422 2004-10-31 04:00:00 2004-10-31 04:00:00
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
drop table t1;
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
select * from t1;
ts
19730101235900
20040101235900
drop table t1;

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