Commit be1fb160 authored by unknown's avatar unknown

Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint

into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint


BitKeeper/etc/ignore:
  auto-union
mysql-test/mysql-test-run.pl:
  Auto merged
netware/Makefile.am:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
sql/mysql_priv.h:
  Auto merged
tests/Makefile.am:
  Auto merged
mysql-test/install_test_db.sh:
  Manual merge
sql/sql_acl.h:
  Manual merge
parents 56ce4907 0eec6c13
......@@ -1763,7 +1763,9 @@ netware/.deps/my_manage.Po
netware/.deps/mysql_install_db.Po
netware/.deps/mysql_test_run.Po
netware/.deps/mysqld_safe.Po
netware/init_db.sql
netware/libmysql.imp
netware/test_db.sql
pack_isam/*.ds?
perror/*.ds?
perror/*.vcproj
......
......@@ -22,7 +22,7 @@ if [ x$1 = x"--bin" ]; then
BINARY_DIST=1
bindir=../bin
scriptdir=../bin
scriptdir=bin
libexecdir=../libexec
# Check if it's a binary distribution or a 'make install'
......@@ -33,7 +33,7 @@ if [ x$1 = x"--bin" ]; then
then
execdir=../../sbin
bindir=../../bin
scriptdir=../../bin
scriptdir=../bin
libexecdir=../../libexec
else
execdir=../bin
......@@ -43,7 +43,7 @@ else
execdir=../sql
bindir=../client
fix_bin=.
scriptdir=../scripts
scriptdir=scripts
libexecdir=../libexec
fi
......@@ -99,15 +99,13 @@ if [ x$BINARY_DIST = x1 ] ; then
basedir=..
else
basedir=.
EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/"
EXTRA_ARG="--windows"
fi
mysqld_boot="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_boot="$mysqld_boot --no-defaults --bootstrap --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --tmpdir=. $EXTRA_ARG"
echo "running $mysqld_boot"
if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --basedir=$basedir --datadir=mysql-test/$ldata --srcdir=."
echo "running $INSTALL_CMD"
cd ..
if $INSTALL_CMD
then
exit 0
else
......
......@@ -1495,9 +1495,17 @@ sub executable_setup () {
if (!$opt_extern)
{
# Look for SQL scripts directory
$path_sql_dir= mtr_path_exists("$glob_basedir/share",
"$glob_basedir/scripts");
# Look for SQL scripts directory
if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
{
# The SQL scripts are in path_share
$path_sql_dir= $path_share;
}
else
{
$path_sql_dir= mtr_path_exists("$glob_basedir/share",
"$glob_basedir/scripts");
}
if ( $mysql_version_id >= 50100 )
{
......
......@@ -52,8 +52,8 @@ link_sources:
done
else
BUILT_SOURCES = libmysql.imp
DISTCLEANFILES = $(BUILT_SOURCES)
BUILT_SOURCES = libmysql.imp init_db.sql test_db.sql
CLEANFILES = $(BUILT_SOURCES)
# Create the libmysql.imp from libmysql/libmysql.def
libmysql.imp: $(top_srcdir)/libmysql/libmysql.def
......@@ -63,7 +63,7 @@ libmysql.imp: $(top_srcdir)/libmysql/libmysql.def
x>1 {printf(",\n %s", $$1); next} \
/EXPORTS/{x=1}' $(top_srcdir)/libmysql/libmysql.def > libmysql.imp
EXTRA_DIST= $(BUILT_SOURCES) comp_err.def init_db.sql install_test_db.ncf \
EXTRA_DIST= $(BUILT_SOURCES) comp_err.def install_test_db.ncf \
libmysql.def \
libmysqlmain.c my_manage.c my_manage.h \
my_print_defaults.def myisam_ftdump.def myisamchk.def \
......@@ -77,7 +77,7 @@ EXTRA_DIST= $(BUILT_SOURCES) comp_err.def init_db.sql install_test_db.ncf \
mysqlshow.def mysqltest.def mysqlslap.def mysql_upgrade.def \
perror.def \
mysql_client_test.def \
replace.def resolve_stack_dump.def resolveip.def test_db.sql \
replace.def resolve_stack_dump.def resolveip.def \
static_init_db.sql \
BUILD/apply-patch BUILD/compile-AUTOTOOLS \
BUILD/compile-linux-tools BUILD/compile-netware-END \
......@@ -88,6 +88,26 @@ EXTRA_DIST= $(BUILT_SOURCES) comp_err.def init_db.sql install_test_db.ncf \
BUILD/cron-build BUILD/crontab BUILD/knetware.imp \
BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \
BUILD/nwbootstrap BUILD/openssl.imp BUILD/save-patch
# Build init_db.sql from the files that contain
# the system tables for this version of MySQL plus any commands
init_db.sql: $(top_srcdir)/scripts/mysql_system_tables.sql \
$(top_srcdir)/scripts/mysql_system_tables_data.sql
@echo "Building $@";
@echo "CREATE DATABASE mysql;" > $@;
@echo "CREATE DATABASE test;" >> $@;
@echo "use mysql;" >> $@;
@cat $(top_srcdir)/scripts/mysql_system_tables.sql \
$(top_srcdir)/scripts/mysql_system_tables_fix.sql >> $@;
# Build test_db.sql from init_db.sql plus
# some test data
test_db.sql: init_db.sql $(top_srcdir)/scripts/mysql_test_data_timezone.sql
@echo "Building $@";
@cat init_db.sql \
$(top_srcdir)/scripts/mysql_test_data_timezone.sql >> $@;
endif
# Don't update the files from bitkeeper
......
CREATE DATABASE mysql;
CREATE DATABASE test;
USE mysql;
CREATE TABLE 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') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') 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 user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') 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, PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
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','','','','',0,0,0);
INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user (host,user) values ('localhost','');
INSERT INTO user (host,user) values ('','');
CREATE TABLE 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') NOT NULL, PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
CREATE TABLE help_topic (help_topic_id int unsigned NOT NULL, name varchar(64) NOT NULL, help_category_id smallint unsigned NOT NULL, description text NOT NULL, example text NOT NULL, url varchar(128) NOT NULL, primary key (help_topic_id), unique index (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='help topics';
CREATE TABLE help_category (help_category_id smallint unsigned NOT NULL, name varchar(64) NOT NULL, parent_category_id smallint unsigned null, url varchar(128) NOT NULL, primary key (help_category_id), unique index (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='help categories';
CREATE TABLE help_keyword (help_keyword_id int unsigned NOT NULL, name varchar(64) NOT NULL, primary key (help_keyword_id), unique index (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='help keywords';
CREATE TABLE help_relation (help_topic_id int unsigned NOT NULL references help_topic, help_keyword_id int unsigned NOT NULL references help_keyword, primary key (help_keyword_id, help_topic_id)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='keyword-topic relation';
CREATE TABLE time_zone_name (Name char(64) NOT NULL,Time_zone_id int unsigned NOT NULL,PRIMARY KEY Name (Name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Time zone names';
CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Time zones';
CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Time zone transitions';
CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Time zone transition types';
CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Leap seconds information for time zones';
This diff is collapsed.
......@@ -303,12 +303,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
......
......@@ -411,8 +411,9 @@ MY_LOCALE *my_locale_by_number(uint number);
updated (to store more bytes on disk).
NOTE: When adding new SQL_MODE types, make sure to also add them to
../scripts/mysql_create_system_tables.sh and
../scripts/mysql_fix_privilege_tables.sql
the scripts used for creating the MySQL system tables
in scripts/mysql_system_tables.sql and scripts/mysql_system_tables_fix.sql
*/
#define RAID_BLOCK_SIZE 1024
......
......@@ -47,8 +47,7 @@
don't forget to update
1. static struct show_privileges_st sys_privileges[]
2. static const char *command_array[] and static uint command_lengths[]
3. mysql_create_system_tables.sh, mysql_fix_privilege_tables.sql
and mysql-test/lib/init_db.sql
3. mysql_system_tables.sql and mysql_system_tables_fix.sql
4. acl_init() or whatever - to define behaviour for old privilege tables
5. sql_yacc.yy - for GRANT/REVOKE to work
*/
......
......@@ -31,7 +31,7 @@ EXTRA_DIST = auto_increment.res auto_increment.tst \
insert_and_repair.pl \
grant.pl grant.res test_delayed_insert.pl \
pmail.pl mail_to_db.pl table_types.pl \
udf_test udf_test.res myisam-big-rows.tst \
myisam-big-rows.tst \
CMakeLists.txt
bin_PROGRAMS = mysql_client_test
......
#
# For this script to work, you need to compile and install the
# udf_example script !
#
CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so";
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so";
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so";
CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so";
CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so";
CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "udf_example.so";
CREATE FUNCTION myfunc_argument_name RETURNS STRING SONAME "udf_example.so";
select metaphon("hello");
select myfunc_double("hello","world");
select myfunc_int(1,2,3),myfunc_int("1","11","111");
select lookup("localhost");
select reverse_lookup("127.0.0.1");
create temporary table t1 (a int,b double);
insert into t1 values (1,5),(1,4),(2,8),(3,9),(4,11);
select avgcost(a,b) from t1;
select avgcost(a,b) from t1 group by a;
select a, myfunc_argument_name(a), myfunc_argument_name(a as b) from t1;
drop table t1;
DROP FUNCTION metaphon;
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_int;
DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
DROP FUNCTION myfunc_argument_name;
--------------
CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
CREATE FUNCTION myfunc_argument_name RETURNS STRING SONAME "udf_example.so"
--------------
Query OK, 0 rows affected
--------------
select metaphon("hello")
--------------
metaphon("hello")
HL
1 row in set
--------------
select myfunc_double("hello","world")
--------------
myfunc_double("hello","world")
108.40
1 row in set
--------------
select myfunc_int(1,2,3),myfunc_int("1","11","111")
--------------
myfunc_int(1,2,3) myfunc_int("1","11","111")
6 6
1 row in set
--------------
select lookup("localhost")
--------------
lookup("localhost")
127.0.0.1
1 row in set
--------------
select reverse_lookup("127.0.0.1")
--------------
reverse_lookup("127.0.0.1")
localhost
1 row in set
--------------
create temporary table t1 (a int,b double)
--------------
Query OK, 0 rows affected
--------------
insert into t1 values (1,5),(1,4),(2,8),(3,9),(4,11)
--------------
Query OK, 5 rows affected
Records: 0 Duplicates: 5 Warnings: 0
--------------
select avgcost(a,b) from t1
--------------
avgcost(a,b)
8.7273
1 row in set
--------------
select avgcost(a,b) from t1 group by a
--------------
avgcost(a,b)
4.5000
8.0000
9.0000
11.0000
4 rows in set
--------------
select a, myfunc_argument_name(a) from t1;
--------------
a myfunc_argument_name(a) myfunc_argument_name(a as b)
1 a b
1 a b
2 a b
3 a b
4 a b
5 rows in set
--------------
drop table t1
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION metaphon
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION myfunc_double
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION myfunc_int
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION lookup
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION reverse_lookup
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION avgcost
--------------
Query OK, 0 rows affected
--------------
DROP FUNCTION myfunc_argument_name;
--------------
Query OK, 0 rows affected
Bye
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