diff options
author | unknown <msvensson@pilot.blaudden> | 2007-04-24 11:11:45 +0200 |
---|---|---|
committer | unknown <msvensson@pilot.blaudden> | 2007-04-24 11:11:45 +0200 |
commit | 67a9f239f064b3fa1be5be3e514016da66c06bf5 (patch) | |
tree | af2058646f9c18fec1543128f882e7026e7b2fc6 /scripts | |
parent | ea397372a36f21d1617844e0b276ec527aa31fdf (diff) | |
parent | 0d5a18b53bd30af029b27e39579b52f05b8f7115 (diff) | |
download | mariadb-git-67a9f239f064b3fa1be5be3e514016da66c06bf5.tar.gz |
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
scripts/mysql_system_tables_fix.sql:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/CMakeLists.txt | 32 | ||||
-rw-r--r-- | scripts/Makefile.am | 23 | ||||
-rw-r--r-- | scripts/comp_sql.c | 125 | ||||
-rw-r--r-- | scripts/fill_func_tables.sh | 250 | ||||
-rw-r--r-- | scripts/fill_help_tables.sh | 614 | ||||
-rw-r--r-- | scripts/make_binary_distribution.sh | 57 | ||||
-rwxr-xr-x | scripts/make_win_bin_dist | 38 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 17 | ||||
-rw-r--r-- | scripts/mysql_system_tables.sql | 23 | ||||
-rw-r--r-- | scripts/mysql_system_tables_data.sql | 22 | ||||
-rw-r--r-- | scripts/mysql_system_tables_fix.sql | 114 |
11 files changed, 283 insertions, 1032 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100755 index 00000000000..bca0581ecbc --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (C) 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +ADD_EXECUTABLE(comp_sql comp_sql.c) +TARGET_LINK_LIBRARIES(comp_sql dbug mysys strings) + +# Build comp_sql - used for embedding SQL in C or C++ programs +GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION) + +ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c + COMMAND ${COMP_SQL_EXE} + mysql_fix_privilege_tables + mysql_fix_privilege_tables.sql + mysql_fix_privilege_tables_sql.c + DEPENDS comp_sql ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql) + +ADD_CUSTOM_TARGET(GenFixPrivs + ALL + DEPENDS ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 934202b5c60..9d344118f2b 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -15,6 +15,11 @@ ## Process this file with automake to create Makefile.in +BUILT_SOURCES = mysql_fix_privilege_tables.sql \ + mysql_fix_privilege_tables_sql.c + +noinst_PROGRAMS = comp_sql + bin_SCRIPTS = @server_scripts@ \ msql2mysql \ mysql_config \ @@ -57,7 +62,8 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) \ mysqlaccess.conf \ mysqlbug \ make_win_bin_dist \ - mysql_system_tables_fix.sql + mysql_system_tables_fix.sql \ + CMakeLists.txt dist_pkgdata_DATA = fill_help_tables.sql \ mysql_fix_privilege_tables.sql \ @@ -82,7 +88,8 @@ CLEANFILES = @server_scripts@ \ mysqldumpslow \ mysql_tableinfo \ mysqld_multi \ - mysql_fix_privilege_tables.sql + mysql_fix_privilege_tables.sql \ + mysql_fix_privilege_tables_sql.c # mysqlbug should be distributed built so that people can report build # failures with it. @@ -99,6 +106,17 @@ mysql_fix_privilege_tables.sql: mysql_system_tables.sql \ @echo "Building $@"; @cat mysql_system_tables.sql mysql_system_tables_fix.sql > $@ +# +# Build mysql_fix_privilege_tables_sql.c from +# mysql_fix_privileges_tables.sql using comp_sql +# +mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql + $(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT) + $(top_builddir)/scripts/comp_sql$(EXEEXT) \ + mysql_fix_privilege_tables \ + $(top_srcdir)/scripts/mysql_fix_privilege_tables.sql $@ + + SUFFIXES = .sh .sh: @@ -154,5 +172,6 @@ SUFFIXES = .sh @CHMOD@ +x $@-t @MV@ $@-t $@ + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c new file mode 100644 index 00000000000..88e88e632b6 --- /dev/null +++ b/scripts/comp_sql.c @@ -0,0 +1,125 @@ +/* Copyright (C) 2004 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Written by Magnus Svensson +*/ + +/* + Converts a SQL file into a C file that can be compiled and linked + into other programs +*/ + +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> + +FILE *in, *out; + +static void die(const char *fmt, ...) +{ + va_list args; + + /* Print the error message */ + fprintf(stderr, "FATAL ERROR: "); + if (fmt) + { + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + } + else + fprintf(stderr, "unknown error"); + fprintf(stderr, "\n"); + fflush(stderr); + + /* Close any open files */ + if (in) + fclose(in); + if (out) + fclose(out); + + exit(1); +} + + +int main(int argc, char *argv[]) +{ + char buff[512]; + char* struct_name= argv[1]; + char* infile_name= argv[2]; + char* outfile_name= argv[3]; + + if (argc != 4) + die("Usage: comp_sql <struct_name> <sql_filename> <c_filename>"); + + /* Open input and output file */ + if (!(in= fopen(infile_name, "r"))) + die("Failed to open SQL file '%s'", infile_name); + if (!(out= fopen(outfile_name, "w"))) + die("Failed to open output file '%s'", outfile_name); + + fprintf(out, "const char* %s={\n\"", struct_name); + + while (fgets(buff, sizeof(buff), in)) + { + char *curr= buff; + while (*curr) + { + if (*curr == '\n') + { + /* + Reached end of line, add escaped newline, escaped + backslash and a newline to outfile + */ + fprintf(out, "\\n \"\n\""); + curr++; + } + else if (*curr == '\r') + { + curr++; /* Skip */ + } + else + { + if (*curr == '"') + { + /* Needs escape */ + fputc('\\', out); + } + + fputc(*curr, out); + curr++; + } + } + if (*(curr-1) != '\n') + { + /* + Some compilers have a max string length, + insert a newline at every 512th char in long + strings + */ + fprintf(out, "\"\n\""); + } + } + + fprintf(out, "\\\n\"};\n"); + + fclose(in); + fclose(out); + + exit(0); + +} + diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh deleted file mode 100644 index 4d28bda7fb5..00000000000 --- a/scripts/fill_func_tables.sh +++ /dev/null @@ -1,250 +0,0 @@ -#!@PERL@ -# Copyright (C) 2003 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# fill_func_tables - parse ../Docs/manual.texi -# -# Original version by Victor Vagin <vva@mysql.com> -# - -my $cat_name= ""; -my $func_name= ""; -my $text= ""; -my $example= ""; - -local $mode= ""; - -sub prepare_name -{ - my ($a)= @_; - - $a =~ s/(\@itemize \@bullet)/ /g; - $a =~ s/(\@end itemize)/ /g; - $a =~ s/(\@end multitable)/ /g; - $a =~ s/(\@end table)/ /g; - $a =~ s/(\@cindex(.*?)\n)/ /g; - $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g; - $a =~ s/(\@node(.*?)\n)/ /g; - $a =~ s/(\@tab)/\t/g; - $a =~ s/\@item/ /g; - $a =~ s/\@code\{((.|\n)+?)\}/$1/go; - $a =~ s/\@strong\{(.+?)\}/$1/go; - $a =~ s/\@samp\{(.+?)\}/$1/go; - $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go; - $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go; - $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go; - $a =~ s/\'/\'\'/g; - $a =~ s/\\/\\\\/g; - $a =~ s/\`/\`\`/g; - - $a =~ s/\@table \@code/ /g; - - $a =~ s/\(\)//g; - - $a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs; #$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3 $1/gxs; - $a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs;#$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1 $2/gxs; - $a =~ s/((\w|\s)+)\((.+)\)/$1/gxs; - - return $a; -} - -sub prepare_text -{ - my ($a)= @_; - - $a =~ s/(\@itemize \@bullet)/ /g; - $a =~ s/(\@end itemize)/ /g; - $a =~ s/(\@end multitable)/ /g; - $a =~ s/(\@end table)/ /g; - $a =~ s/(\@cindex(.*?)\n)/ /g; - $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g; - $a =~ s/(\@node(.*?)\n)/ /g; - $a =~ s/(\@tab)/\t/g; - $a =~ s/\@itemx/ /g; - $a =~ s/\@item/ /g; - $a =~ s/\@code\{((.|\n)+?)\}/$1/go; - $a =~ s/\@strong\{(.+?)\}/$1/go; - $a =~ s/\@samp\{(.+?)\}/$1/go; - $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go; - $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go; - $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go; - $a =~ s/\'/\'\'/g; - $a =~ s/\\/\\\\/g; - $a =~ s/\`/\`\`/g; - $a =~ s/(\n*?)$//g; - $a =~ s/\n/\\n/g; - - $a =~ s/\@table \@code/ /g; - - return $a; -} - -sub prepare_example -{ - my ($a)= @_; - - $a =~ s/\'/\'\'/g; - $a =~ s/\\/\\\\/g; - $a =~ s/\`/\`\`/g; - $a =~ s/(\n*?)$//g; - $a =~ s/\n/\\n/g; - - return $a; -} - -sub flush_all -{ - my ($mode) = @_; - - if ($mode eq ""){return;} - - $func_name= prepare_name($func_name); - $text= prepare_text($text); - $example= prepare_example($example); - - if ($func_name ne "" && $text ne "" && !($func_name =~ /[abcdefghikjlmnopqrstuvwxyz]/)){ - print "INSERT INTO function (name,description,example) VALUES ("; - print "'$func_name',"; - print "'$text',"; - print "'$example'"; - print ");\n"; - print "INSERT INTO function_category (cat_id,func_id) VALUES (\@cur_category,LAST_INSERT_ID());\n"; - } - - $func_name= ""; - $text= ""; - $example= ""; - $mode= ""; -} - -sub new_category -{ - my ($category)= @_; - - $category= prepare_text($category); - - print "INSERT INTO function_category_name (name) VALUES (\'$category\');\n"; - print "SELECT \@cur_category:=LAST_INSERT_ID();\n"; -} - -print "INSERT INTO db (Host,DB,User,Select_priv) VALUES ('%','mysql_help','','Y');\n"; -print "CREATE DATABASE mysql_help;\n"; - -print "USE mysql_help;\n"; - -print "DROP TABLE IF EXISTS function;\n"; -print "CREATE TABLE function ("; -print " func_id int unsigned not null auto_increment,"; -print " name char(64) not null,"; -print " url char(128) not null,"; -print " description text not null,"; -print " example text not null,"; -print " min_args tinyint not null,"; -print " max_args tinyint,"; -print " date_created datetime not null,"; -print " last_modified timestamp not null,"; -print " primary key (func_id)"; -print ") ENGINE=MYISAM;\n\n"; - -print "DROP TABLE IF EXISTS function_category_name;\n"; -print "CREATE TABLE function_category_name ("; -print " cat_id smallint unsigned not null auto_increment,"; -print " name char(64) not null,"; -print " url char(128) not null,"; -print " date_created datetime not null,"; -print " last_modified timestamp not null,"; -print " primary key (cat_id)"; -print ") ENGINE=MYISAM;\n\n"; - -print "DROP TABLE IF EXISTS function_category;\n"; -print "CREATE TABLE function_category ("; -print " cat_id smallint unsigned not null references function_category_name,"; -print " func_id int unsigned not null references function,"; -print " primary key (cat_id, func_id)"; -print ") ENGINE=MYISAM;\n\n"; - -print "DELETE FROM function_category_name;\n"; -print "DELETE FROM function_category;\n"; -print "DELETE FROM function;\n"; -print "SELECT \@cur_category:=null;\n\n"; - -my $in_section_6_3= 0; - -for(<>) -{ - if ($_=~/\@section Functions for Use in \@code{SELECT} and \@code{WHERE} Clauses/ && - !$in_section_6_3){ - $in_section_6_3= 1; - next; - } - - if ($_=~/\@section/ && $in_section_6_3){ - $in_section_6_3= 0; - next; - } - - if (!$in_section_6_3) { next; } - - my $c_name= ""; - - ($c_name)=m|\@c for_mysql_help,(.+?)$|; - if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){ - ($cat_name)= $c_name; - new_category($cat_name); - next; - } - - ($c_name)=m|\@subsubsection (.+?)$|; - if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){ - ($cat_name)= $c_name; - new_category($cat_name); - next; - } - - ($c_name)=m|\@subsection (.+?)$|; - if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){ - ($cat_name)= $c_name; - new_category($cat_name); - next; - } - - ($f_name)=m|\@findex (.+?)$|; - if (!($f_name eq "")){ - flush_all($mode); - ($func_name)= ($f_name); - $mode= "text"; - next; - } - - if ($_=~/\@example/ && ($mode eq "text")){ - $mode= "example"; - next; - } - - if ($_=~/\@end example/ && ($mode eq "example")){ - flush_all($mode); - next; - } - - if ($mode eq "text") { $text .= $_; } - if ($mode eq "example") { $example .= $_; } -} - - -print "DELETE function_category_name "; -print "FROM function_category_name "; -print "LEFT JOIN function_category ON function_category.cat_id=function_category_name.cat_id "; -print "WHERE function_category.cat_id is null;" - diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh deleted file mode 100644 index e600d24032b..00000000000 --- a/scripts/fill_help_tables.sh +++ /dev/null @@ -1,614 +0,0 @@ -#!@PERL@ -# Copyright (C) 2003 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# This script generates the SQL statements required by mysql_install_db to -# fill up the tables for the server-side online function help, which can be -# invoked with "help <function>" from the MySQL client. -# -# Usage: -# fill_help_tables OPTIONS < manual.texi > fill_help_tables.sql -# -# --help display this helpscreen and exit -# --verbose print information about help completeness to STDERR -# --lexems=path path to file with lexems. it is used with verbose option. -# default value is ../sql/lex.h -# Examples: -# ./fill_help_tables --help -# ./fill_help_tables --verbose < manual.texi > fill_help_tables.sql -# ./fill_help_tables < manual.texi > fill_help_tables.sql -# -# Please note, that you first need to update Docs/manual.texi with the -# manual file from the separate "mysqldoc" BitKeeper-Tree! The manual.texi -# included in the source tree is just an empty stub file - the full manual -# is now maintained in a separate tree. -# -# extra tags in manual.texi: -# -# @c help_category <category_name>[@<parent_category_name>] -# -# @c description_for_help_topic <topic_name> <keyword1> <keyword2> -# .... -# @c end_description_for_help_topic -# -# @c example_for_help_topic <topic_name> -# @example -# .... -# @end example -# -# -# Original version by Victor Vagin <vva@mysql.com> -# - -use strict; -use Getopt::Long; - -my $insert_portion_size= 15; -my $error_prefix= "---- help parsing errors :"; - -my $path_to_lex_file= "../sql/lex.h"; -my $verbose_option= 0; -my $help_option= 0; - -my $cur_line= 0; -my $count_errors= 0; - -GetOptions( - "help",\$help_option, - "verbose",\$verbose_option, - "lexems=s",\$path_to_lex_file -); - -if ($help_option ne 0) -{ - print <<_HELP; - -This script generates the SQL statements required by mysql_install_db to -fill up the tables for the server-side online function help, which can be -invoked with "help <function>" from the MySQL client. - -Usage: - fill_help_tables OPTIONS < manual.texi > fill_help_tables.sql - - --help display this helpscreen and exit - --verbose print information about help completeness to STDERR - --lexems=path path to file with lexems. it is used with verbose option. - default value is ../sql/lex.h - -Examples: - ./fill_help_tables --help - ./fill_help_tables --verbose < manual.texi > fill_help_tables.sql - ./fill_help_tables < manual.texi > fill_help_tables.sql - -_HELP - exit; -} - -my $current_category= ""; -my $current_parent_category= ""; -my $next_example_for_topic= ""; - -my %topics; -my %categories; -my %keywords; - -$categories{Contents}->{__parent_category__}= ""; - -sub print_error -{ - my ($text)= @_; - if ($count_errors==0) - { - print STDERR "$error_prefix\n"; - } - print STDERR "line $cur_line : $text"; - $count_errors++; -} - -sub add_topic_to_category -{ - my ($topic_name)= @_; - - $categories{$current_category}->{$topic_name}= $topics{$topic_name}; - my $category= $categories{$current_category}; - $category->{__name__}= $current_category; - - if (exists($category->{__parent_category__})) - { - my $old_parent= $category->{__parent_category__}; - if ($old_parent ne $current_parent_category) - { - print_error "wrong parent for $current_category\n"; - } - } - - if ($current_parent_category ne "") - { - $category->{__parent_category__}= $current_parent_category; - } - - if (exists($topics{$topic_name}->{category})) - { - my $old_category= $topics{$topic_name}->{category}; - if ($old_category ne $category) - { - print_error "wrong category for $topic_name (first one's \"$old_category->{__name__}\" second one's \"$current_category\")\n"; - } - } - - $topics{$topic_name}->{category}= $category; -} - -sub add_example -{ - my ($topic_name,$example)= @_; - - $topic_name=~ tr/a-z/A-Z/; - - if (exists($topics{$topic_name}->{example})) - { - print_error "double example for $topic_name\n"; - } - - $topics{$topic_name}->{example}= $example; - add_topic_to_category($topic_name); -} - -sub add_description -{ - my ($topic_name,$description)= @_; - - $topic_name=~ tr/a-z/A-Z/; - - if (exists($topics{$topic_name}->{description})) - { - print_error "double description for $topic_name\n"; - } - $topics{$topic_name}->{description}= $description; - add_topic_to_category($topic_name); -} - -sub add_keyword -{ - my ($topic_name,$keyword)= @_; - - $topic_name=~ tr/a-z/A-Z/; - $keyword=~ tr/a-z/A-Z/; - - push(@{$topics{$topic_name}->{keywords}},$keyword); - if (exists($keywords{$keyword}->{$topic_name})) - { - print_error "double keyword $keyword for $topic_name\n"; - } - $keywords{$keyword}->{$topic_name}= $topics{$topic_name}; -} - -sub prepare_name -{ - my ($a)= @_; - - $a =~ s/(\@itemize \@bullet)/ /g; - $a =~ s/(\@end itemize)/ /g; - $a =~ s/(\@end multitable)/ /g; - $a =~ s/(\@end table)/ /g; - $a =~ s/(\@cindex(.*?)\n)/ /g; - $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g; - $a =~ s/(\@node(.*?)\n)/ /g; - $a =~ s/(\@tab)/\t/g; - $a =~ s/\@item/ /g; - $a =~ s/\@minus\{\}/-/g; - $a =~ s/\@dots\{\}/.../g; - $a =~ s/\@var\{((.|\n)+?)\}/$1/go; - $a =~ s/\@command\{((.|\n)+?)\}/$1/go; - $a =~ s/\@code\{((.|\n)+?)\}/$1/go; - $a =~ s/\@strong\{(.+?)\}/$1/go; - $a =~ s/\@samp\{(.+?)\}/'$1'/go; - $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go; - $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go; - $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go; - $a =~ s/\'/\'\'/g; - $a =~ s/\\/\\\\/g; - $a =~ s/\`/\`\`/g; - - $a =~ s/\@table \@code/ /g; - $a =~ s/\(\)//g; - $a =~ s/\"/\\\"/g; - - $a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs; - $a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs; - $a =~ s/((\w|\s)+)\((.+)\)/$1/gxs; - - $a =~ s/((\s)+)$//g; - - return $a; -} - -sub prepare_description -{ - my ($a)= @_; - - $a =~ s/(\@itemize \@bullet\n)//g; - $a =~ s/(\@c help_keyword (.*?)\n)//g; - $a =~ s/(\@end itemize\n)//g; - $a =~ s/(\@end example\n)//g; - $a =~ s/(\@example\n)//g; - $a =~ s/(\@{)/{/g; - $a =~ s/(\@})/}/g; - $a =~ s/(\@end multitable)/ /g; - $a =~ s/(\@end table)/ /g; - $a =~ s/(\@cindex(.*?)\n)//g; - $a =~ s/(\@findex(.*?)\n)//g; - $a =~ s/(\@table(.*?)\n)//g; - $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g; - $a =~ s/(\@node(.*?)\n)/ /g; - $a =~ s/(\@tab)/\t/g; - $a =~ s/\@itemx/ /g; - $a =~ s/(\@item\n(\s*?))(\S)/ --- $3/g; - $a =~ s/(\@item)/ /g; - $a =~ s/(\@tindex\s(.*?)\n)//g; - $a =~ s/(\@c\s(.*?)\n)//g; - $a =~ s/\@minus\{\}/-/g; - $a =~ s/\@dots\{\}/.../g; - $a =~ s/\@var\{((.|\n)+?)\}/$1/go; - $a =~ s/\@command\{((.|\n)+?)\}/$1/go; - $a =~ s/\@code\{((.|\n)+?)\}/$1/go; - $a =~ s/\@strong\{(.+?)\}/$1/go; - $a =~ s/\@samp\{(.+?)\}/'$1'/go; - $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go; - $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go; - $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go; - $a =~ s/\@w\{((.|\n)+?)\}/$1/go; - $a =~ s/\@strong\{((.|\n)+?)\}/\n!!!!\n$1\n!!!!\n/go; - $a =~ s/\@file\{((.|\n)+?)\}/\*$1/go; - $a =~ s/\\/\\\\/g; - $a =~ s/\n\n$/\n/g; - $a =~ s/\n\n$/\n/g; - $a =~ s/\n\n$/\n/g; - $a =~ s/\n\n$/\n/g; - $a =~ s/\n\n$/\n/g; - $a =~ s/\n/\\n/g; - $a =~ s/\"/\\\"/g; - - $a =~ s/\@table \@code/ /g; - - return $a; -} - -sub prepare_example -{ - my ($a)= @_; - - $a =~ s/(^\@c for_help_topic(.*?)\n)//g; - - $a =~ s/\@var\{((.|\n)+?)\}/$1/go; - $a =~ s/\@dots\{\}/.../g; - $a =~ s/\\/\\\\/g; - $a =~ s/(\@{)/{/g; - $a =~ s/(\@})/}/g; - $a =~ s/(\@\@)/\@/g; - $a =~ s/(\n*?)$//g; - $a =~ s/\n/\\n/g; - $a =~ s/\"/\\\"/g; - - return $a; -} - -sub parse_example -{ - return if (!($_=~/\@example/)); - return if ($next_example_for_topic eq ""); - - my $topic_name= $next_example_for_topic; - $next_example_for_topic= ""; - my $text= ""; - - while (<>) - { - $cur_line++; - last if ($_=~/\@end example/); - $text .= $_; - } - - $text= prepare_example($text); - $topic_name= prepare_name($topic_name); - add_example($topic_name,$text) if ($topic_name ne ""); -} - -sub parse_example_for_topic -{ - my ($for_topic)= m|\@c example_for_help_topic (.+?)$|; - return if ($for_topic eq ""); - - $next_example_for_topic= $for_topic; -} - -sub parse_description -{ - my ($topic_description)= m|\@c description_for_help_topic (.+?)$|; - return if ($topic_description eq ""); - - my ($topic_name,$topic_keywords)= split(/ /,$topic_description); - - if ($topic_name eq "" || $topic_keywords eq "") - { - $topic_name= $topic_description; - } - else - { - my $keyword; - foreach $keyword (split(/ /,$topic_keywords)) - { - add_keyword($topic_name,$keyword) if ($keyword ne ""); - } - } - - my $text= ""; - - while (<>) - { - $cur_line++; - last if ($_=~/\@c end_description_for_help_topic/); - $text .= $_; - } - - $text= prepare_description($text); - $topic_name= prepare_name($topic_name); - add_description($topic_name,$text); -} - -sub parse_category -{ - my ($c_name,$pc_name)= m|\@c help_category (.+?)\@(.+?)$|; - - if ($pc_name ne "") - { - $current_category= prepare_name($c_name); - $current_parent_category= prepare_name($pc_name); - } - else - { - my ($c_name)=m|\@c help_category (.+?)$|; - return if ($c_name eq ""); - - $current_category= prepare_name($c_name); - $current_parent_category= "Contents" - } -} - -# parse manual: - -while (<>) -{ - parse_example_for_topic (); - parse_example (); - parse_description (); - parse_category (); - $cur_line++; -} - -# test results of parsing: - -sub print_bad_names -{ - my($names,$prompt)= @_; - if (scalar(@{$names})) - { - print STDERR "\n-------------- $prompt : \n\n"; - my $name; - foreach $name (@{$names}) - { - print STDERR "$name\n"; - } - print STDERR "\n"; - } -} - -sub print_verbose_errors -{ - my($name_of_log_file)= @_; - - my @without_help; - my @description_with_at; - my @example_with_at; - my @without_description; - my @without_example; - - print STDERR "\n-------------- parameters of help completeness : \n\n"; - - my $count_lex= 0; - if (!open (TLEX,"<$path_to_lex_file")) - { - print STDERR "Error opening lex file \"$path_to_lex_file\" $!\n"; - } - else - { - for (<TLEX>) - { - my ($a,$lex,$b)=m|(.+?)\"(.+?)\"(.+?)$|; - next if ($lex eq ""); - $count_lex++; - next if (exists($topics{$lex}) || exists($keywords{$lex})); - push(@without_help,$lex); - } - close(TLEX); - print STDERR "number of lexems in \"$path_to_lex_file\" - $count_lex\n"; - } - - my $name; - my @topic_names= keys(%topics); - foreach $name (@topic_names) - { - my $topic= $topics{$name}; - push(@description_with_at,$name) if ($topic->{description}=~/\@/); - push(@example_with_at,$name) if ($topic->{example}=~/\@/); - push(@without_description,$name) if (!exists($topic->{description})); - push(@without_example,$name) if (!exists($topic->{example})); - } - - my $count_categories= scalar(keys(%categories)); - print STDERR "number of help categories - ",$count_categories,"\n"; - my $count_topics= scalar(@topic_names); - print STDERR "number of help topics - ",$count_topics,"\n"; - my $count_keywords= scalar(keys(%keywords)); - print STDERR "number of help keywords - ",$count_keywords,"\n"; - - my $count_without_help= scalar(@without_help); - my $percent_without_help= $count_lex ? - int (($count_without_help/$count_lex)*100) : - "100"; - print_bad_names(\@without_help,"lexems without help (". - $count_without_help." ~ ". - $percent_without_help."%)"); - print_bad_names(\@description_with_at, - " topics below have symbol \'@\' in their descriptions.\n". - "it's probably the litter from 'texi' tags (script needs fixing)"); - print_bad_names(\@example_with_at, - " topics below have symbol \'@\' in their examples.\n". - "it's probably the litter from 'texi' tags (script needs fixing)"); - print_bad_names(\@without_description,"topics without description"); - - my $count_without_example= scalar(@without_example); - my $percent_without_example= $count_topics ? - int (($count_without_example/$count_topics)*100) : - "100"; - print_bad_names(\@without_example,"topics without example (". - $count_without_example." ~ ". - $percent_without_example."%)"); -} - -print_verbose_errors if ($verbose_option ne 0); - -# output result - -sub print_insert_header -{ - my($count,$header)= @_; - - if ($count % $insert_portion_size ne 0) { - print ","; - } else { - print ";\n" if ($count ne 0); - print "$header"; - } -} - -print <<EOF; --- Copyright (C) 2000-2005 MySQL AB --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; version 2 of the License. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -EOF -print "set sql_mode='';\n"; -print "delete from help_topic;\n"; -print "delete from help_category;\n"; -print "delete from help_keyword;\n"; -print "delete from help_relation;\n\n"; - -my @category_names= keys(%categories); -if (scalar(@category_names)) -{ - my $cat_name; - my $count= 0; - foreach $cat_name (@category_names) - { - $categories{$cat_name}->{__id__}= $count; - $count++; - } - - my $header= "insert into help_category ". - "(help_category_id,name,parent_category_id) values "; - $count= 0; - foreach $cat_name (@category_names) - { - print_insert_header($count,$header); - my $parent_cat_name= $categories{$cat_name}->{__parent_category__}; - my $parent_cat_id= $parent_cat_name eq "" - ? "-1" : $categories{$parent_cat_name}->{__id__}; - print "($count,\"$cat_name\",$parent_cat_id)"; - $count++; - } - printf ";\n\n"; -} - -my @topic_names= keys(%topics); -if (scalar(@topic_names)) -{ - my $header= "insert into help_topic ". - "(help_topic_id,help_category_id,name,description,example) values "; - my $topic_name; - my $count= 0; - foreach $topic_name (@topic_names) - { - print_insert_header($count,$header); - my $topic= $topics{$topic_name}; - print "($count,"; - print "$topic->{category}->{__id__},"; - print "\"$topic_name\","; - print "\"$topic->{description}\","; - print "\"$topic->{example}\")"; - $topics{$topic_name}->{__id__}= $count; - $count++; - } - printf ";\n\n"; -} - -my @keywords_names= keys(%keywords); -if (scalar(@keywords_names)) -{ - my $header= "insert into help_keyword (help_keyword_id,name) values "; - my $keyword_name; - my $count= 0; - foreach $keyword_name (@keywords_names) - { - print_insert_header($count,$header); - print "($count,\"$keyword_name\")"; - $count++; - } - printf ";\n\n"; - - $header= "insert into help_relation ". - "(help_topic_id,help_keyword_id) values "; - $count= 0; - my $count_keyword= 0; - foreach $keyword_name (@keywords_names) - { - my $topic_name; - foreach $topic_name (keys(%{$keywords{$keyword_name}})) - { - print_insert_header($count,$header); - print "($topics{$topic_name}->{__id__},$count_keyword)"; - $count++; - } - $count_keyword++; - } - printf ";\n\n"; -} - -if ($count_errors) -{ - print STDERR "$count_errors errors !!!\n"; - exit 1; -} diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index fb72666baba..83d7e237a54 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -54,6 +54,21 @@ for arg do esac done +# Avoid too long command lines for cp (bug#27489) +MCP() { + for i + do + last=$i + done + for i + do + if test "x$i" != "x$last" + then + cp -p $i $last + fi + done +} + # Remove vendor from $system system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'` @@ -117,7 +132,12 @@ if [ $BASE_SYSTEM != "netware" ] ; then chmod o-rwx $BASE/data $BASE/data/* fi -# Copy files if they exists, warn for those that don't +# Copy files if they exists, warn for those that don't. +# Note that when listing files to copy, we might list the file name +# twice, once in the directory location where it is build, and a +# second time in the ".libs" location. In the case the firs one +# is a wrapper script, the second one will overwrite it with the +# binary file. copyfileto() { destdir=$1 @@ -168,6 +188,7 @@ if [ $BASE_SYSTEM = "netware" ] ; then # For all other platforms: else BIN_FILES="$BIN_FILES \ + server-tools/instance-manager/.libs/mysqlmanager \ client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ client/.libs/mysqlslap \ client/.libs/mysqldump client/.libs/mysqlimport \ @@ -253,25 +274,25 @@ copyfileto $BASE/mysql-test \ mysql-test/valgrind.supp \ netware/mysql_test_run.nlm netware/install_test_db.ncf -$CP mysql-test/lib/*.pl $BASE/mysql-test/lib -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/include/*.inc $BASE/mysql-test/include -$CP mysql-test/include/*.test $BASE/mysql-test/include -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ +MCP mysql-test/lib/*.pl $BASE/mysql-test/lib +MCP mysql-test/t/*.def $BASE/mysql-test/t +MCP mysql-test/include/*.inc $BASE/mysql-test/include +MCP mysql-test/include/*.test $BASE/mysql-test/include +MCP mysql-test/t/*.def $BASE/mysql-test/t +MCP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \ mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ $BASE/mysql-test/std_data -$CP mysql-test/t/*.test $BASE/mysql-test/t -$CP mysql-test/t/*.imtest mysql-test/t/*.disabled $BASE/mysql-test/t -$CP mysql-test/t/*.opt mysql-test/t/*.slave-mi $BASE/mysql-test/t -$CP mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t -$CP mysql-test/r/*.result $BASE/mysql-test/r -$CP mysql-test/r/*.require $BASE/mysql-test/r -$CP mysql-test/extra/binlog_tests/*.test $BASE/mysql-test/extra/binlog_tests -$CP mysql-test/extra/rpl_tests/*.test $BASE/mysql-test/extra/rpl_tests +MCP mysql-test/t/*.test $BASE/mysql-test/t +MCP mysql-test/t/*.imtest mysql-test/t/*.disabled $BASE/mysql-test/t +MCP mysql-test/t/*.opt mysql-test/t/*.slave-mi $BASE/mysql-test/t +MCP mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t +MCP mysql-test/r/*.result $BASE/mysql-test/r +MCP mysql-test/r/*.require $BASE/mysql-test/r +MCP mysql-test/extra/binlog_tests/*.test $BASE/mysql-test/extra/binlog_tests +MCP mysql-test/extra/rpl_tests/*.test $BASE/mysql-test/extra/rpl_tests if [ $BASE_SYSTEM != "netware" ] ; then chmod a+x $BASE/bin/* @@ -303,12 +324,6 @@ rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \ # Copy system dependent files # if [ $BASE_SYSTEM = "netware" ] ; then - echo "CREATE DATABASE mysql;" > $BASE/bin/init_db.sql - echo "CREATE DATABASE test;" >> $BASE/bin/init_db.sql - sh ./scripts/mysql_create_system_tables.sh real "" "%" 0 \ - >> $BASE/bin/init_db.sql - sh ./scripts/mysql_create_system_tables.sh test "" "%" 0 \ - > $BASE/bin/test_db.sql ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql fi diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 146dcad95f1..42fade7cbd2 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -127,6 +127,15 @@ if [ -e $DESTDIR ] ; then fi # ---------------------------------------------------------------------- +# Adjust target name if needed, release with debug info has another name +# ---------------------------------------------------------------------- + +if [ x"$TARGET" = x"release" -a -f "client/relwithdebinfo/mysql.exe" ] +then + TARGET="relwithdebinfo" +fi + +# ---------------------------------------------------------------------- # Copy executables, and client DLL (FIXME why?) # ---------------------------------------------------------------------- @@ -134,18 +143,27 @@ trap 'echo "Clearning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR mkdir $DESTDIR mkdir $DESTDIR/bin -cp client/$TARGET/*.exe $DESTDIR/bin/ -cp extra/$TARGET/*.exe $DESTDIR/bin/ -cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/ -cp server-tools/instance-manager/$TARGET/*.exe $DESTDIR/bin/ -cp tests/$TARGET/*.exe $DESTDIR/bin/ -cp libmysql/$TARGET/*.exe $DESTDIR/bin/ -cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ +cp client/$TARGET/*.exe $DESTDIR/bin/ +cp extra/$TARGET/*.exe $DESTDIR/bin/ +cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/ +cp server-tools/instance-manager/$TARGET/*.{exe,map} $DESTDIR/bin/ +if [ x"$TARGET" != x"release" ] +then + cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/ +fi +cp tests/$TARGET/*.exe $DESTDIR/bin/ +cp libmysql/$TARGET/*.exe $DESTDIR/bin/ +cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ # FIXME really needed?! mv $DESTDIR/bin/comp_err.exe $DESTDIR/bin/comp-err.exe cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe +cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map +if [ x"$TARGET" != x"release" ] +then + cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb +fi if [ x"$PACK_DEBUG" = "" -a -f "sql/debug/mysqld.exe" -o \ x"$PACK_DEBUG" = "yes" ] ; then @@ -302,6 +320,7 @@ cp mysql-test/std_data/*.cnf $DESTDIR/mysql-test/std_data/ cp mysql-test/std_data/*.dat $DESTDIR/mysql-test/std_data/ cp mysql-test/std_data/*.frm $DESTDIR/mysql-test/std_data/ cp mysql-test/std_data/*.pem $DESTDIR/mysql-test/std_data/ +cp mysql-test/std_data/*.MY* $DESTDIR/mysql-test/std_data/ cp mysql-test/t/*.opt $DESTDIR/mysql-test/t/ cp mysql-test/t/*.sh $DESTDIR/mysql-test/t/ cp mysql-test/t/*.slave-mi $DESTDIR/mysql-test/t/ @@ -333,7 +352,7 @@ mkdir -p $DESTDIR/scripts for i in `cd scripts && ls`; do \ if echo $i | grep -q '\.sh'; then \ cp scripts/$i $DESTDIR/scripts/`echo $i | sed -e 's/\.sh$//'`; \ - elif [ $i = Makefile.am -o $i = Makefile.in -o -e scripts/$i.sh ] ; then \ + elif [ -d scripts/$i -o $i = Makefile.am -o $i = Makefile.in -o -e scripts/$i.sh ] ; then \ : ; \ else \ cp scripts/$i $DESTDIR/scripts/$i; \ @@ -342,6 +361,9 @@ done cp -pR sql/share $DESTDIR/ +# The SQL initiation code is really expected to be in "share" +mv $DESTDIR/scripts/*.sql $DESTDIR/share/ || true + # ---------------------------------------------------------------------- # Copy other files specified on command line DEST=SOURCE # ---------------------------------------------------------------------- diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index da2438c606c..8ff7a9c11e1 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -181,7 +181,6 @@ then fi # Find executables and paths -mdata=$ldata/mysql mysqld=$execdir/mysqld mysqld_opt="" scriptdir=$bindir @@ -264,12 +263,6 @@ if test -w / -a ! -z "$user"; then chown $user $ldata $ldata/mysql $ldata/test; fi -# Check is "db" table already exist -if test ! -f $mdata/db.frm -then - db_table_already_exist="yes" -fi - if test -n "$user"; then args="$args --user=$user" fi @@ -322,16 +315,6 @@ then echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" echo "See the manual for more instructions." - # Print message about upgrading unless we have created a new db table. - if test -z "$db_table_already_exist" - then - echo - echo "NOTE: If you are upgrading from a previous MySQL verision you " - echo "should run '$bindir/mysql_upgrade', to make sure all tables have " - echo "been upgraded for this version of MySQL" - fi - echo - if test "$in_rpm" = "0" then echo "You can start the MySQL daemon with:" diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 7be5c94ad80..c779d174d12 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -6,12 +6,17 @@ set storage_engine=myisam; CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; +-- Remember for later if db table already existed +set @had_db_table= @@warning_count != 0; CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +-- Remember for later if user table already existed +set @had_user_table= @@warning_count != 0; + CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; @@ -60,17 +65,17 @@ CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NU CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; -CREATE PROCEDURE create_general_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT, thread_id INTEGER, server_id INTEGER, command_type VARCHAR(64), argument MEDIUMTEXT) engine=CSV CHARACTER SET utf8 comment='General log'; END IF; END; -CALL create_general_log_table(); -DROP PROCEDURE create_general_log_table; - - -CREATE PROCEDURE create_slow_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512), last_insert_id INTEGER, insert_id INTEGER, server_id INTEGER, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment='Slow log'; END IF; END; -CALL create_slow_log_table(); -DROP PROCEDURE create_slow_log_table; +delimiter ;; +CREATE PROCEDURE create_general_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT, thread_id INTEGER, server_id INTEGER, command_type VARCHAR(64), argument MEDIUMTEXT) engine=CSV CHARACTER SET utf8 comment='General log'; END IF; END;; +CALL create_general_log_table();; +DROP PROCEDURE create_general_log_table;; +CREATE PROCEDURE create_slow_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512), last_insert_id INTEGER, insert_id INTEGER, server_id INTEGER, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment='Slow log'; END IF; END;; +CALL create_slow_log_table();; +DROP PROCEDURE create_slow_log_table;; +delimiter ; -CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; +CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index 0ac6f59b9ea..07aa932cda2 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -2,12 +2,20 @@ -- The inital data for system tables of MySQL Server -- --- default grants for anyone to access database 'test' and 'test_%' -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); +-- Fill "db" table with default grants for anyone to +-- access database 'test' and 'test_%' if "db" table didn't exist +CREATE TEMPORARY TABLE tmp_db LIKE db; +INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); +INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); +INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; +DROP TABLE tmp_db; --- default users allowing root access from local machine -INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO user VALUES (@@hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +-- Fill "users" table with default users allowing root access +-- from local machine if "users" table didn't exist before +CREATE TEMPORARY TABLE tmp_user LIKE user; +INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO tmp_user VALUES (@@hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; +DROP TABLE tmp_user; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 27c0f3b5bd4..6fbf20a2c9f 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -389,117 +389,22 @@ ALTER TABLE proc MODIFY db char(64) collate utf8_bin DEFAULT '' NOT NULL; # -# Create missing log tables (5.1) -# - -delimiter // -CREATE PROCEDURE create_log_tables() -BEGIN - DECLARE is_csv_enabled int DEFAULT 0; - SELECT @@have_csv = 'YES' INTO is_csv_enabled; - IF (is_csv_enabled) THEN - CREATE TABLE IF NOT EXISTS general_log ( - event_time TIMESTAMP NOT NULL, - user_host MEDIUMTEXT, - thread_id INTEGER, - server_id INTEGER, - command_type VARCHAR(64), - argument MEDIUMTEXT - ) engine=CSV CHARACTER SET utf8 comment='General log'; - CREATE TABLE IF NOT EXISTS slow_log ( - start_time TIMESTAMP NOT NULL, - user_host MEDIUMTEXT NOT NULL, - query_time TIME NOT NULL, - lock_time TIME NOT NULL, - rows_sent INTEGER NOT NULL, - rows_examined INTEGER NOT NULL, - db VARCHAR(512), - last_insert_id INTEGER, - insert_id INTEGER, - server_id INTEGER, - sql_text MEDIUMTEXT NOT NULL - ) engine=CSV CHARACTER SET utf8 comment='Slow log'; - END IF; -END// -delimiter ; -CALL create_log_tables(); -DROP PROCEDURE create_log_tables; -# -# EVENT table -# - - -CREATE TABLE event ( - db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', - name char(64) CHARACTER SET utf8 NOT NULL default '', - body longblob NOT NULL, - definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', - execute_at DATETIME default NULL, - interval_value int(11) default NULL, - interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK', - 'SECOND','MICROSECOND', 'YEAR_MONTH','DAY_HOUR', - 'DAY_MINUTE','DAY_SECOND', - 'HOUR_MINUTE','HOUR_SECOND', - 'MINUTE_SECOND','DAY_MICROSECOND', - 'HOUR_MICROSECOND','MINUTE_MICROSECOND', - 'SECOND_MICROSECOND') default NULL, - created TIMESTAMP NOT NULL, - modified TIMESTAMP NOT NULL, - last_executed DATETIME default NULL, - starts DATETIME default NULL, - ends DATETIME default NULL, - status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', - on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', - sql_mode set( - 'REAL_AS_FLOAT', - 'PIPES_AS_CONCAT', - 'ANSI_QUOTES', - 'IGNORE_SPACE', - 'NOT_USED', - 'ONLY_FULL_GROUP_BY', - 'NO_UNSIGNED_SUBTRACTION', - 'NO_DIR_IN_CREATE', - 'POSTGRESQL', - 'ORACLE', - 'MSSQL', - 'DB2', - 'MAXDB', - 'NO_KEY_OPTIONS', - 'NO_TABLE_OPTIONS', - 'NO_FIELD_OPTIONS', - 'MYSQL323', - 'MYSQL40', - 'ANSI', - 'NO_AUTO_VALUE_ON_ZERO', - 'NO_BACKSLASH_ESCAPES', - 'STRICT_TRANS_TABLES', - 'STRICT_ALL_TABLES', - 'NO_ZERO_IN_DATE', - 'NO_ZERO_DATE', - 'INVALID_DATES', - 'ERROR_FOR_DIVISION_BY_ZERO', - 'TRADITIONAL', - 'NO_AUTO_CREATE_USER', - 'HIGH_NOT_PRECEDENCE' - ) DEFAULT '' NOT NULL, - comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', - PRIMARY KEY (db,name) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; - - -# # EVENT privilege # - SET @hadEventPriv := 0; SELECT @hadEventPriv :=1 FROM user WHERE Event_priv LIKE '%'; ALTER TABLE user add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv; ALTER TABLE user MODIFY Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv; +UPDATE user SET Event_priv=Super_priv WHERE @hadEventPriv = 0; + ALTER TABLE db add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL; ALTER TABLE db MODIFY Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL; +# +# EVENT table +# ALTER TABLE event DROP PRIMARY KEY; ALTER TABLE event ADD PRIMARY KEY(db, name); ALTER TABLE event ADD sql_mode @@ -534,9 +439,12 @@ ALTER TABLE event ADD sql_mode 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL AFTER on_completion; - -UPDATE user SET Event_priv=Super_priv WHERE @hadEventPriv = 0; ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE event ADD COLUMN originator INT(10) NOT NULL; +ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED'; + +ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1 + NOT NULL DEFAULT 'SYSTEM' AFTER originator; # # TRIGGER privilege @@ -558,8 +466,6 @@ ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; -CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; - # Activate the new, possible modified privilege tables # This should not be needed, but gives us some extra testing that the above # changes was correct |