Commit c8d8213d authored by unknown's avatar unknown

Merge paul@work.mysql.com:/home/bk/mysql-4.0

into teton.kitebird.com:/home/paul/mysql-4.0


Docs/manual.texi:
  Auto merged
parents a1476d61 75a268a6
This diff is collapsed.
#!/usr/bin/perl -w
#
# Script to rewrite colspecs from relative values to absolute values
#
use strict;
my $table_width = 12.75; # cm
my $gutter_width = 0.09; # cm
my $str = join '', <>;
$str =~ s{([\t ]*(<colspec colwidth=\".+?\" />\s*)+)}
{&rel2abs($1)}ges;
print STDOUT $str;
exit;
#
# Definitions for helper sub-routines
#
sub msg {
print STDERR shift, "\n";
}
sub rel2abs {
my $str = shift;
my @widths = ();
my $total = 0;
my $output = '';
$str =~ /^(\s+)/;
my $ws = $1;
while ($str =~ m/<colspec colwidth="(\d+)\*" \/>/g) {
$total += $1;
push @widths, $1;
}
my $unit = ($table_width - ($#widths * $gutter_width)) / ($total);
foreach (@widths) {
$output .= $ws . '<colspec colwidth="'. sprintf ("%0.2f", $_ * $unit) .'" />' . "\n";
}
return $output . "\n$ws";
}
#!/usr/bin/perl -w
# 2002-02-15 zak@mysql.com
# Use -w to make perl print useful warnings about the script being run
sub fix_underscore {
$str = shift;
$str =~ tr/_/-/;
return $str;
};
# Fix the output of `makeinfo --docbook` version 4.0c
# Convert the broken docbook output to well-formed XML that conforms to the O'Reilly idiom
# See code for detailed comments
# Authors: Arjen Lentz and Zak Greant
sub strip_emph {
$str = shift;
$str =~ s{<emphasis>(.+?)</emphasis>}
{$1}gs;
return $str;
};
use strict;
print STDERR "\n--Post-processing makeinfo output--\n";
my $data = '';
my @apx = ();
my $apx = '';
my @nodes = ();
my $nodes = '';
# 2002-02-15 zak@mysql.com
print STDERR "Discard DTD - ORA can add the appropriate DTD for their flavour of DocBook\n";
<STDIN>;
msg ("\n-- Post-processing `makeinfo --docbook` output --");
msg ("** Written to work with makeinfo version 4.0c **\n");
print STDERR "Slurp! In comes the rest of the file. :)\n";
$data = join "", <STDIN>;
msg ("Discarding DTD - not required by subsequent scripts");
# <> is a magic filehandle - either reading lines from stdin or from file(s) specified on the command line
<>;
# 2002-02-15 zak@mysql.com
print STDERR "Add an XML processing instruction with the right character encoding\n";
$data = "<?xml version='1.0' encoding='ISO-8859-1'?>" . $data;
msg ("Create an XML PI with ISO-8859-1 character encoding");
$data = "<?xml version='1.0' encoding='ISO-8859-1'?>";
# 2002-02-15 zak@mysql.com
# Less than optimal - should be fixed in makeinfo
print STDERR "Put in missing <bookinfo> and <abstract>\n";
$data =~ s/<book lang="en">/<book lang="en"><bookinfo><abstract>/gs;
msg ("Get the rest of the data");
$data = $data . join "", <>;
# 2002-02-15 zak@mysql.com
print STDERR "Convert existing ampersands to escape sequences \n";
$data =~ s/&(?!\w+;)/&amp;/gs;
msg ("Add missing <bookinfo> and <abstract> opening tags");
# Note the absence of the g (global) pattern modified. This situation can only happen once.
# ...as soon as we find the first instance, we can stop looking.
$data =~ s/<book lang="en">/<book lang="en"><bookinfo><abstract>/;
# 2002-02-15 zak@mysql.com
# Need to talk to Arjen about what the <n> bits are for
print STDERR "Rework references of the notation '<n>'\n";
$data =~ s/<(\d)>/[$1]/gs;
msg ("Removing mailto: from email addresses...");
$data =~ s/mailto://g;
# 2002-02-15 zak@mysql.com
# We might need to encode the high-bit characters to ensure proper representation
# print STDERR "Converting high-bit characters to entities\n";
# $data =~ s/([\200-\400])/&get_entity($1)>/gs;
# There is no get_entity function yet - no point writing it til we need it :)
msg ("Removing INFORMALFIGURE...");
$data =~ s{<informalfigure>.+?</informalfigure>}
{}gs;
print STDERR "Changing @@ to @...\n";
$data =~ s/@@/@/gs;
msg ("Convert ampersands to XML escape sequences ");
$data =~ s/&(?!\w+;)/&amp;/g;
print STDERR "Changing '_' to '-' in references...\n";
$data =~ s{id=\"(.+?)\"}
{"id=\"".&fix_underscore($1)."\""}gsex;
$data =~ s{linkend=\"(.+?)\"}
{"linkend=\"".&fix_underscore($1)."\""}gsex;
msg ("Changing @@ to @...");
$data =~ s/@@/@/g;
print STDERR "Changing ULINK to SYSTEMITEM...\n";
$data =~ s{<ulink url=\"(.+?)\"></ulink>}
{<systemitem role=\"url\">$1</systemitem>}gs;
msg ("Rework references of the notation '<n>'");
# Need to talk to Arjen about what the <n> bits are for
$data =~ s/<(\d)>/[$1]/g;
print STDERR "Removing INFORMALFIGURE...\n";
$data =~ s{<informalfigure>(.+?)</informalfigure>}
{}gs;
msg ("Changing '_' to '-' in references...");
$data =~ s{((?:id|linkend)=\".+?\")}
{&underscore2hyphen($1)}gex;
msg ("Changing ULINK to SYSTEMITEM...");
$data =~ s{<ulink url=\"(.+?)\">\s*</ulink>}
{<systemitem role=\"url\">$1</systemitem>}gs;
print STDERR "Adding PARA inside ENTRY...\n";
msg ("Adding PARA inside ENTRY...");
$data =~ s{<entry>(.*?)</entry>}
{<entry><para>$1</para></entry>}gs;
print STDERR "Removing mailto: from email addresses...\n";
$data =~ s{mailto:}
{}gs;
msg ("Fixing spacing problem with titles...");
$data =~ s{(</\w+>)(\w{2,})}
{$1 $2}gs;
print STDERR "Fixing spacing problem with titles...\n";
$data =~ s{</(\w+)>(\w{2,})}
{</$1> $2}gs;
msg ("Adding closing / to XREF and COLSPEC tags...");
$data =~ s{<(xref|colspec) (.+?)>}
{<$1 $2 />}gs;
# 2002-02-15 arjen@mysql.com
print STDERR "Adding closing / to XREF...\n";
$data =~ s{<xref (.+?)>}
{<xref $1 />}gs;
# Probably need to strip these
msg ('Adding "See " to XREFs that used to be @xref...');
$data =~ s{([.'!)])\s*<xref }
{$1 See <xref }gs;
# 2002-01-30 arjen@mysql.com
print STDERR "Removing COLSPEC...\n";
$data =~ s{\n *<colspec colwidth=\"[0-9]+\*\">}
{}gs;
msg ('Adding "see " to (XREFs) that used to be (@pxref)...');
$data =~ s{([([,;])(\s*)<xref }
{$1$2see <xref }gs;
# 2002-01-31 arjen@mysql.com
print STDERR "Making first row in table THEAD...\n";
$data =~ s{([ ]*)<tbody>\n([ ]*<row>(.+?)</row>)}
{$1<thead>\n$2\n$1</thead>\n$1<tbody>}gs;
msg ("Making first row in table THEAD...");
$data =~ s{( *)<tbody>(\s*<row>.+?</row>)}
{$1<thead>$2\n$1</thead>\n$1<tbody>}gs;
# 2002-01-31 arjen@mysql.com
print STDERR "Removing EMPHASIS inside THEAD...\n";
msg ("Removing EMPHASIS inside THEAD...");
$data =~ s{<thead>(.+?)</thead>}
{"<thead>".&strip_emph($1)."</thead>"}gsex;
{"<thead>".&strip_tag($1, 'emphasis')."</thead>"}gsex;
# 2002-01-31 arjen@mysql.com
print STDERR "Removing lf before /PARA in ENTRY...\n";
$data =~ s{(<entry><para>(.+?))\n(</para></entry>)}
{$1$3}gs;
# 2002-01-31 arjen@mysql.com (2002-02-15 added \n stuff)
print STDERR "Removing whitespace before /PARA if not on separate line...\n";
$data =~ s{([^\n ])[ ]+</para>}
{$1</para>}gs;
msg ("Removing empty PARA...");
$data =~ s{<para>\s*</para>}
{}gs;
# 2002-01-31 arjen@mysql.com
print STDERR "Removing empty PARA in ENTRY...\n";
$data =~ s{<entry><para></para></entry>}
{<entry></entry>}gs;
msg ("Removing lf before /PARA in ENTRY...");
$data =~ s{\n(</para></entry>)}
{$1}gs;
# 2002-01-31 arjen@mysql.com
print STDERR "Removing PARA around INDEXENTRY if no text in PARA...\n";
$data =~ s{<para>((<indexterm role=\"(cp|fn)\">(<(primary|secondary)>[^<]+?</(primary|secondary)>)+?</indexterm>)+?)[\n]*</para>[\n]*}
{$1\n}gs;
msg ("Removing whitespace before /PARA if not on separate line...");
$data =~ s{(\S+)[\t ]+</para>}
{$1</para>}g;
# -----
msg ("Removing PARA around INDEXTERM if no text in PARA...");
$data =~ s{<para>((?:<indexterm role=\"(?:cp|fn)\">(?:<(primary|secondary)>[^>]+</\2>)+?</indexterm>)+?)\s*</para>}
{$1}gs;
@apx = ("Users", "MySQL Testimonials", "News",
"GPL-license", "LGPL-license");
@apx = ("Users", "MySQL Testimonials", "News", "GPL-license", "LGPL-license");
foreach $apx (@apx) {
print STDERR "Removing appendix $apx...\n";
msg ("Removing appendix $apx...");
$data =~ s{<appendix id=\"$apx\">(.+?)</appendix>}
{}gs;
print STDERR " ... Building list of removed nodes ...\n";
foreach(split "\n", $&) {
push @nodes, $2 if(/<(\w+) id=\"(.+?)\">/)
};
};
print STDERR "Fixing references to removed nodes...\n";
foreach $node (@nodes) {
$web = $node;
$web =~ s/[ ]/_/;
$web = "http://www.mysql.com/doc/" .
(join "/", (split //, $web)[0..1])."/$web.html";
print STDERR "$node -> $web\n";
$data =~ s{<(\w+) linkend=\"$node\">}
{$web}gs;
};
# Skip to next appendix regex if the regex did not match anything
next unless (defined $&);
msg ("...Building list of removed nodes...");
# Split the last bracketed regex match into an array
# Extract the node names from the tags and push them into an array
foreach (split "\n", $&) {
push @nodes, $1 if /<\w+ id=\"(.+?)\">/
}
}
# 2002-02-22 arjen@mysql.com (added fix " /" to end of regex, to make it match)
msg ("Fixing references to removed nodes...");
# Merge the list of node names into a set of regex alternations
$nodes = join "|", @nodes;
# Find all references to removed nodes and convert them to absolute URLs
$data =~ s{<\w+ linkend="($nodes)" />}
{&xref2link($1)}ges;
print STDOUT $data;
exit;
#
# Definitions for helper sub-routines
#
sub msg {
print STDERR shift, "\n";
}
sub strip_tag($$) {
(my $str, my $tag) = @_;
$str =~ s{<$tag>(.+?)</$tag>}{$1}gs;
return $str;
}
sub underscore2hyphen($) {
my $str = shift;
$str =~ tr/_/-/;
return $str;
}
sub xref2link {
my $ref = shift;
$ref =~ tr/ /_/;
$ref =~ s{^((.)(.).+)$}{$2/$3/$1.html};
return "http://www.mysql.com/doc/" . $ref;
}
# We might need to encode the high-bit characters to ensure proper representation
# msg ("Converting high-bit characters to entities");
# $data =~ s/([\200-\400])/&get_entity($1)>/gs;
# There is no get_entity function yet - no point writing it til we need it :)
#! /usr/local/bin/perl
#! /usr/bin/perl -w
# O'Reilly's Perl script to chop mysql.xml into separate ch/apps/index files.
# The indexes are actually not used, they're created straight from the xrefs.
use strict;
# Breaks the MySQL reference manual into chapters, appendices, and indexes.
my $input_file;
my $directory;
my $chap_num;
my $app_letter;
my $start_text;
my $line;
my $input_file;
my $output_name;
$input_file = "mysql.xml";
$directory="chaps_apps_index";
$chap_num=1; # Start chapter numbers at one (there is no preface)
$app_letter="a"; # Start appendix letters at "a"
$start_text="";
$line="";
open (INPUT_FILE, '<' . $input_file) or die "Cannot open $input_file";
if (-d $directory) {
my $unlinked = unlink <$directory/*>;
printf(Removed "%d files\n", $unlinked);
}
else {
mkdir $directory or die "Cannot make $directory subdirectory";
}
use strict;
while (1) {
my $app_letter = "a"; # Start appendix letters at "a"
my $chap_num = 1; # Start chapter numbers at one (there is no preface)
my $directory = "mysql_refman_" . time;
my $ext = ".xml";
my $line = "";
my $output_name = "";
my $start_text = "";
# Terminating statement for loop.
exit if not defined $line;
mkdir $directory unless -d $directory;
if ($line =~ /(?:.*)(<chapter.*)/i ) {
while (defined $line) {
if ($line =~ /(<chapter.+)/i ) {
$start_text = $1;
$output_name = &make_chapter_name($chap_num);
$chap_num++;
$output_name = sprintf("ch%02d%s", $chap_num, $ext);
++$chap_num;
&process_file("chapter");
}
elsif ($line =~ /(?:.*)(<appendix.*)/i ) {
elsif ($line =~ /(<appendix.+)/i ) {
$start_text = $1 ;
$output_name = &make_appendix_name($app_letter);
$app_letter++;
$output_name = "app$app_letter$ext";
++$app_letter;
&process_file("appendix");
}
elsif ($line =~ /(?:.*)(<index\s+id=")(.*?)(">.*)/i ) {
elsif ($line =~ /(<index\s+id=")(.*?)(">.*)/i ) {
$start_text = $1 . $2 . $3;
$output_name = lc($2) . ".xml";
$output_name = lc($2) . $ext;
&process_file("index");
}
else {
# Automatically skips junk in between chapters, appendices,
# and indexes.
$line = <INPUT_FILE>;
# Skip junk in between chapters, appendices and indexes.
$line = <>;
}
}
sub make_chapter_name {
my $num = shift;
my $name = "ch" . sprintf("%02d", $num) . ".xml";
return $name;
}
sub process_file {
my $marker = shift;
my $path = "$directory/$output_name";
sub make_appendix_name {
my $letter = shift;
my $name = "app" . sprintf("%s", $letter) . ".xml";
return $name;
}
open (OUTPUT_FILE, ">$path") or die "Cannot open $path";
print STDERR "Creating $path\n";
# Print out XML PI
print OUTPUT_FILE "<?xml version='1.0' encoding='ISO-8859-1'?>\n";
sub process_file {
my $marker=shift;
open (OUTPUT_FILE, '>' . $directory . "/" . $output_name) or
die "Cannot open $output_name";
# Print whatever happened to appear at the end of the previous chapter.
print OUTPUT_FILE $start_text . "\n" if $start_text;
while (1) {
$line = <INPUT_FILE>;
exit if not defined $line;
print OUTPUT_FILE "$start_text\n" if $start_text;
while (defined $line) {
$line = <>;
# Note: Anything after the terminating marker is lost, just like
# lines in between chapters.
if ($line =~ /(.*<\/\s*$marker\s*>)/i ) {
print OUTPUT_FILE $1 . "\n" if $1;
print OUTPUT_FILE "$1\n" if $1;
close OUTPUT_FILE;
return;
}
......
......@@ -18,3 +18,7 @@
# See if the XML output is well-formed
xmlwf mysql.xml
# If all is well, keep processing
cat mysql.xml | Support/colspec-fix.pl | Support/docbook-split;
@c This file is autogenerated by the Makefile
@set mysql_version 4.0.2
@set default_port 3306
This diff is collapsed.
......@@ -757,10 +757,9 @@ Large server clusters using replication are in production use, with
good results. Work on enhanced replication features is continuing
in @code{MySQL} 4.0.
@item @code{InnoDB} tables -- Stable (in 3.23 from 3.23.47)
@item @code{InnoDB} tables -- Stable (in 3.23 from 3.23.49)
The @code{InnoDB} transactional table handler has now been declared
stable in the @code{MySQL} 3.23 development tree, starting from
version 3.23.47.
stable in the @code{MySQL} 3.23 tree, starting from version 3.23.49.
@code{InnoDB} is being used in large, heavy load production systems.
@item @code{BDB} tables -- Gamma
......@@ -1707,7 +1706,7 @@ development of the @code{MySQL} database.
@code{MySQL} partnership logos may only be used by companies and persons
having a written partnership agreement with @code{MySQL AB}. Partnerships
include certification as a @code{MySQL} trainer or consultant.
Please see @xref{Business Services Partnering,,Partnering}.
Please see @ref{Business Services Partnering,,Partnering}.
@node Using MySQL word in presentations, Using MySQL word in company and product names, MySQL AB Partnership Logos, MySQL AB Logos and Trademarks
......@@ -2496,7 +2495,7 @@ perhaps solved) the problem.
For information on reporting bugs in @strong{MyODBC}, see @ref{ODBC Problems}.
For solutions to some common problems, see @xref{Problems}.
For solutions to some common problems, see @ref{Problems}.
When answers are sent to you individually and not to the mailing list,
it is considered good etiquette to summarise the answers and send the
......@@ -5276,7 +5275,7 @@ isn't good at many things (it is!) or that it isn't faster than MySQL Server
under certain conditions. We would just like to see a fair test where
they are very good so that we could get some friendly competition going!
For more information about our benchmarks suite @xref{MySQL Benchmarks}.
For more information about our benchmarks suite, see @ref{MySQL Benchmarks}.
We are working on an even better benchmark suite, including multi user
tests, and a better documentation of what the individual tests really
......@@ -15347,7 +15346,7 @@ starts up. Changes to the grant tables take effect as indicated in
When you modify the contents of the grant tables, it is a good idea to make
sure that your changes set up privileges the way you want. For help in
diagnosing problems, see @ref{Access denied}. For advice on security issues,
@pxref{Security}.
see @ref{Security}.
A useful
diagnostic tool is the @code{mysqlaccess} script, which Yves Carlier has
......@@ -16594,7 +16593,7 @@ dropped only with explicit @code{REVOKE} commands or by manipulating the
MySQL grant tables.
@end itemize
For a description of using @code{REQUIRE}, see @xref{Secure connections}.
For a description of using @code{REQUIRE}, see @ref{Secure connections}.
@node User names, Privilege changes, GRANT, User Account Management
@subsection MySQL User Names and Passwords
......@@ -17476,7 +17475,7 @@ minimum needed to restore it. Currenlty only works for @code{MyISAM}
tables. For @code{MyISAM} table, copies @code{.frm} (definition) and
@code{.MYD} (data) files. The index file can be rebuilt from those two.
Before using this command, please see @xref{Backup}.
Before using this command, please see @ref{Backup}.
During the backup, read lock will be held for each table, one at time,
as they are being backed up. If you want to backup several tables as
......@@ -23257,11 +23256,11 @@ it is not the only one. For example, if you already have a snapshot
of the master, and
the master already has server id set and binary logging enabled, one can
set up a slave without shutting the master down or even blocking the updates.
Please refer to @xref{Replication FAQ}. for more details.
For more details, please see @ref{Replication FAQ}.
If you want to become a real MySQL replication guru, we suggest that you
begin with studing, pondering, and trying all commands
mentioned in @xref{Replication SQL}. You should also familiarize yourself
mentioned in @ref{Replication SQL}. You should also familiarize yourself
with replication startup options in @code{my.cnf} in
@xref{Replication Options}.
......@@ -31054,7 +31053,7 @@ relevance - similarity measure between the text in columns
positive floating-point number. Zero relevance means no similarity.
@code{MATCH ... AGAINST()} is available in MySQL version
3.23.23 or later. @code{IN BOOLEAN MODE} extension was added in version
4.0.1. For details and usage examples @pxref{Fulltext Search}.
4.0.1. For details and usage examples, see @ref{Fulltext Search}.
@end table
@node Case Sensitivity Operators, , String comparison functions, String functions
......@@ -44272,7 +44271,7 @@ This chapter describes a lot of things that you need to know when
working on the MySQL code. If you plan to contribute to MySQL
development, want to have access to the bleeding-edge in-between
versions code, or just want to keep track of development, follow the
instructions in @xref{Installing source tree}.
instructions in @ref{Installing source tree}.
If you are interested in MySQL internals, you should also subscribe
to our @code{internals} mailing list. This list is relatively low
traffic. For details on how to subscribe, please see
......@@ -47600,6 +47599,10 @@ Utility from Artronic to stop MySQL on win9x.
@item @uref{http://bardo.hyperlink.cz/mysqlmon/}
A light weight GUI client for Windows.
@item @uref{http://www.mysqlfront.de/}
MySQLfront is a very nice Windows client with lots of useful features.
By Angsar Becker.
@item @uref{http://www.dbtools.com.br/}
Dbtools, a tool to manage MySQL databases. Currently only for Windows.
Some features:
......@@ -291,6 +291,11 @@ WWW (@uref{http://mysql.tecnoera.com/})
@image{Flags/chile} Chile [Vision] @@
WWW (@uref{http://mysql.vision.cl/})
@item
@image{Flags/costarica} Costa Rica [Ogmios Communications] @@
WWW (@uref{http://mysql.ogmios.co.cr/})
FTP (@uref{ftp://mysql.ogmios.co.cr/pub/mysql/})
@end itemize
@strong{Asia:}
......
......@@ -2687,6 +2687,13 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
#endif /* HAVE_OPENSSL */
if (want_access & GRANT_ACL)
global.append(" WITH GRANT OPTION",18);
else if (acl_user->questions)
{
char buff[65], *p; // just as in int2str
global.append(" WITH MAX_QUERIES_PER_HOUR = ",29);
p=int2str(acl_user->questions,buff,10);
global.append(buff,p-buff);
}
thd->packet.length(0);
net_store_data(&thd->packet,global.ptr(),global.length());
if (my_net_write(&thd->net,(char*) thd->packet.ptr(),
......
......@@ -6963,13 +6963,16 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
List<Item> field_list;
Item *item;
List<Item> item_list;
THD *thd=join->thd;
MYSQL_LOCK *save_lock;
SELECT_LEX *select_lex = &(join->thd->lex.select_lex);
select_result *result=join->result;
DBUG_ENTER("select_describe");
/* Don't log this into the slow query log */
select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
if (join->thd->lex.select == select_lex)
if (thd->lex.select == select_lex)
{
field_list.push_back(new Item_empty_string("table",NAME_LEN));
field_list.push_back(new Item_empty_string("type",10));
......@@ -6985,24 +6988,22 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item->maybe_null=1;
field_list.push_back(new Item_real("rows",0.0,0,10));
field_list.push_back(new Item_empty_string("Extra",255));
if (send_fields(thd,field_list,1))
if (result->send_fields(field_list,1))
return;
}
char buff[512],*buff_ptr;
String tmp(buff,sizeof(buff)),*packet= &thd->packet;
if (message)
{
packet->length(0);
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
net_store_data(packet,message,strlen(message));
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
DBUG_VOID_RETURN;
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_empty_string("",0));
item_list.push_back(new Item_string(message,strlen(message)));
if (result->send_data(item_list))
result->send_error(0,NullS);
}
else
{
......@@ -7011,69 +7012,70 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
JOIN_TAB *tab=join->join_tab+i;
TABLE *table=tab->table;
char buff[512],*buff_ptr=buff;
char buff1[512], buff2[512], bufff[512];
String tmp1(buff1,sizeof(buff1));
String tmp2(buff2,sizeof(buff2));
item_list.empty();
if (tab->type == JT_ALL && tab->select && tab->select->quick)
tab->type= JT_RANGE;
packet->length(0);
net_store_data(packet,table->table_name);
net_store_data(packet,join_type_str[tab->type]);
tmp.length(0);
item_list.push_back(new Item_string(table->table_name,strlen(table->table_name)));
item_list.push_back(new Item_string(join_type_str[tab->type],strlen(join_type_str[tab->type])));
tmp1.length(0); tmp2.length(0);
key_map bits;
uint j;
for (j=0,bits=tab->keys ; bits ; j++,bits>>=1)
{
if (bits & 1)
{
if (tmp.length())
tmp.append(',');
tmp.append(table->key_info[j].name);
if (tmp1.length())
tmp1.append(',');
tmp1.append(table->key_info[j].name);
}
}
if (tmp.length())
net_store_data(packet,tmp.ptr(),tmp.length());
if (tmp1.length())
item_list.push_back(new Item_string(tmp1.ptr(),tmp1.length()));
else
net_store_null(packet);
item_list.push_back(new Item_null());
if (tab->ref.key_parts)
{
net_store_data(packet,table->key_info[tab->ref.key].name);
net_store_data(packet,(uint32) tab->ref.key_length);
tmp.length(0);
item_list.push_back(new Item_string(table->key_info[tab->ref.key].name,strlen(table->key_info[tab->ref.key].name)));
item_list.push_back(new Item_int((int) tab->ref.key_length));
for (store_key **ref=tab->ref.key_copy ; *ref ; ref++)
{
if (tmp.length())
tmp.append(',');
tmp.append((*ref)->name());
if (tmp2.length())
tmp2.append(',');
tmp2.append((*ref)->name());
}
net_store_data(packet,tmp.ptr(),tmp.length());
item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length()));
}
else if (tab->type == JT_NEXT)
{
net_store_data(packet,table->key_info[tab->index].name);
net_store_data(packet,(uint32) table->key_info[tab->index].key_length);
net_store_null(packet);
item_list.push_back(new Item_string(table->key_info[tab->index].name,strlen(table->key_info[tab->index].name)));
item_list.push_back(new Item_int((int) table->key_info[tab->index].key_length));
item_list.push_back(new Item_null());
}
else if (tab->select && tab->select->quick)
{
net_store_data(packet,table->key_info[tab->select->quick->index].name);;
net_store_data(packet,(uint32) tab->select->quick->max_used_key_length);
net_store_null(packet);
item_list.push_back(new Item_string(table->key_info[tab->select->quick->index].name,strlen(table->key_info[tab->select->quick->index].name)));
item_list.push_back(new Item_int((int) tab->select->quick->max_used_key_length));
item_list.push_back(new Item_null());
}
else
{
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
item_list.push_back(new Item_null());
item_list.push_back(new Item_null());
item_list.push_back(new Item_null());
}
sprintf(buff,"%.0f",join->best_positions[i].records_read);
net_store_data(packet,buff);
sprintf(bufff,"%.0f",join->best_positions[i].records_read);
item_list.push_back(new Item_string(bufff,strlen(bufff)));
my_bool key_read=table->key_read;
if (tab->type == JT_NEXT &&
((table->used_keys & ((key_map) 1 << tab->index))))
key_read=1;
buff_ptr=buff;
if (tab->info)
net_store_data(packet,tab->info);
item_list.push_back(new Item_string(tab->info,strlen(tab->info)));
else if (tab->select)
{
if (tab->use_quick == 2)
......@@ -7127,16 +7129,20 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
buff_ptr=strmov(buff_ptr,"Distinct");
}
net_store_data(packet,buff,(uint) (buff_ptr - buff));
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
DBUG_VOID_RETURN; /* Purecov: Inspected */
item_list.push_back(new Item_string(buff,(uint) (buff_ptr - buff)));
// For next iteration
used_tables|=table->map;
if (result->send_data(item_list))
result->send_error(0,NullS);
}
}
if (!join->thd->lex.select->next)
send_eof(&thd->net);
{
save_lock=thd->lock;
thd->lock=(MYSQL_LOCK *)0;
result->send_eof();
thd->lock=save_lock;
}
DBUG_VOID_RETURN;
}
......
......@@ -31,10 +31,11 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
ORDER *order;
List<Item> item_list;
TABLE *table;
int describe=(lex->select_lex.options & SELECT_DESCRIBE) ? 1 : 0;
int res;
TABLE_LIST result_table_list;
TMP_TABLE_PARAM tmp_table_param;
select_union *union_result;
int res;
DBUG_ENTER("mysql_union");
/* Fix tables 'to-be-unioned-from' list to point at opened tables */
......@@ -71,32 +72,25 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
order=0;
}
if (lex->select_lex.options & SELECT_DESCRIBE)
{
for (sl= &lex->select_lex; sl; sl=sl->next)
if (describe)
{
lex->select=sl;
thd->offset_limit=sl->offset_limit;
thd->select_limit=sl->select_limit+sl->offset_limit;
if (thd->select_limit < sl->select_limit)
thd->select_limit= HA_POS_ERROR; // no limit
if (thd->select_limit == HA_POS_ERROR)
sl->options&= ~OPTION_FOUND_ROWS;
res=mysql_select(thd, (TABLE_LIST*) sl->table_list.first,
sl->item_list,
sl->where,
((sl->braces) ?
(ORDER *) sl->order_list.first : (ORDER *) 0),
(ORDER*) sl->group_list.first,
sl->having,
(ORDER*) NULL,
(sl->options | thd->options | SELECT_NO_UNLOCK |
SELECT_DESCRIBE),
result);
}
DBUG_RETURN(0);
Item *item;
item_list.push_back(new Item_empty_string("table",NAME_LEN));
item_list.push_back(new Item_empty_string("type",10));
item_list.push_back(item=new Item_empty_string("possible_keys",
NAME_LEN*MAX_KEY));
item->maybe_null=1;
item_list.push_back(item=new Item_empty_string("key",NAME_LEN));
item->maybe_null=1;
item_list.push_back(item=new Item_int("key_len",0,3));
item->maybe_null=1;
item_list.push_back(item=new Item_empty_string("ref",
NAME_LEN*MAX_REF_PARTS));
item->maybe_null=1;
item_list.push_back(new Item_real("rows",0.0,0,10));
item_list.push_back(new Item_empty_string("Extra",255));
}
else
{
Item *item;
List_iterator<Item> it(lex->select_lex.item_list);
......@@ -113,7 +107,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
bzero((char*) &tmp_table_param,sizeof(tmp_table_param));
tmp_table_param.field_count=item_list.elements;
if (!(table=create_tmp_table(thd, &tmp_table_param, item_list,
(ORDER*) 0, !lex->union_option,
(ORDER*) 0, !describe & !lex->union_option,
1, 0,
(lex->select_lex.options | thd->options |
TMP_TABLE_ALL_COLUMNS))))
......@@ -130,7 +124,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
res= -1;
goto exit;
}
for (sl= &lex->select_lex; sl; sl=sl->next)
union_result->save_time_stamp=!describe;
for (sl=&lex->select_lex;sl;sl=sl->next)
{
thd->offset_limit=sl->offset_limit;
thd->select_limit=sl->select_limit+sl->offset_limit;
......@@ -146,7 +142,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
(ORDER*) sl->group_list.first,
sl->having,
(ORDER*) NULL,
sl->options | thd->options | SELECT_NO_UNLOCK,
sl->options | thd->options | SELECT_NO_UNLOCK | ((describe) ? SELECT_DESCRIBE : 0),
union_result);
if (res)
goto exit;
......@@ -187,6 +183,8 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
if (thd->select_limit == HA_POS_ERROR)
thd->options&= ~OPTION_FOUND_ROWS;
}
if (describe)
thd->select_limit= HA_POS_ERROR; // no limit
res=mysql_select(thd,&result_table_list,
item_list, NULL, /*ftfunc_list,*/ order,
(ORDER*) NULL, NULL, (ORDER*) NULL,
......@@ -222,7 +220,7 @@ select_union::~select_union()
int select_union::prepare(List<Item> &list)
{
if (list.elements != table->fields)
if (save_time_stamp && list.elements != table->fields)
{
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT),MYF(0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment