summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-11-02 08:58:45 +0200
committerunknown <monty@mysql.com>2004-11-02 08:58:45 +0200
commit94839ddf5e23998c4e90776912f7d92a90277628 (patch)
treef21b1c5d561fe5ca25c7f1f93db8805c0f4f3940
parent46aa022aa6cf40801518d1be2c9e8e7ffcee9928 (diff)
parent61ac832464a48afcf85f8c302734aa01d4346c78 (diff)
downloadmariadb-git-94839ddf5e23998c4e90776912f7d92a90277628.tar.gz
merge with 4.0
Build-tools/mysql-copyright: Auto merged Docs/Support/texi2html: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/eval/eval0eval.c: Auto merged innobase/pars/pars0pars.c: Auto merged
-rwxr-xr-xDocs/Support/texi2html98
-rw-r--r--innobase/dict/dict0crea.c16
-rw-r--r--innobase/dict/dict0dict.c4
-rw-r--r--innobase/dict/dict0load.c21
-rw-r--r--innobase/eval/eval0eval.c18
-rw-r--r--innobase/pars/pars0pars.c8
-rw-r--r--innobase/row/row0mysql.c15
-rw-r--r--sql/sql_table.cc10
8 files changed, 129 insertions, 61 deletions
diff --git a/Docs/Support/texi2html b/Docs/Support/texi2html
index 8067d8f72ce..f13c006c7dc 100755
--- a/Docs/Support/texi2html
+++ b/Docs/Support/texi2html
@@ -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);
@@ -1815,8 +1825,10 @@ sub fix_image
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
diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
index 137964b26c1..cbdc0aab53c 100644
--- a/innobase/dict/dict0crea.c
+++ b/innobase/dict/dict0crea.c
@@ -1067,6 +1067,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 =
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n"
@@ -1284,9 +1290,17 @@ loop:
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, trx, 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);
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index c3d0d8d9ac1..bc08fc2437e 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -156,7 +156,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(
@@ -606,7 +606,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
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index d430eadc97b..7f32c79717c 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -19,6 +19,7 @@ Created 4/24/1996 Heikki Tuuri
#include "mach0data.h"
#include "dict0dict.h"
#include "dict0boot.h"
+#include "rem0cmp.h"
#include "srv0start.h"
/************************************************************************
@@ -1242,12 +1243,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)) {
diff --git a/innobase/eval/eval0eval.c b/innobase/eval/eval0eval.c
index ebb6cb1b7d9..5b2d1f857b1 100644
--- a/innobase/eval/eval0eval.c
+++ b/innobase/eval/eval0eval.c
@@ -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);
diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c
index 846cb060a7e..16d630dd318 100644
--- a/innobase/pars/pars0pars.c
+++ b/innobase/pars/pars0pars.c
@@ -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);
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 241ddc310e8..f356ef8081e 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -2314,7 +2314,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"
@@ -2769,7 +2770,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"
@@ -2802,7 +2804,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";
@@ -3012,7 +3015,11 @@ row_rename_table_for_mysql(
if (err != DB_SUCCESS) {
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, trx, new_name);
fputs(" exists in the InnoDB internal data\n"
"InnoDB: dictionary though MySQL is trying rename table ", stderr);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 79cec85927e..2f7a5f32d01 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1780,9 +1780,13 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (prepare_func)
{
switch ((*prepare_func)(thd, table, check_opt)) {
- case 1: continue; // error, message written to net
- case -1: goto err; // error, message could be written to net
- default: ; // should be 0 otherwise
+ case 1: // error, message written to net
+ close_thread_tables(thd);
+ continue;
+ case -1: // error, message could be written to net
+ goto err;
+ default: // should be 0 otherwise
+ ;
}
}