diff options
author | unknown <monty@mysql.com> | 2004-07-07 11:29:39 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-07-07 11:29:39 +0300 |
commit | 11b8987313aab1eb8d9f829731fa0dcd83bf62f5 (patch) | |
tree | ca8974710746bb69b04a49bc64f938d0b1a8420a /netware | |
parent | c92670d80b3674fa025e373e0498eccbb407f873 (diff) | |
parent | 9890cd9a9eb37083d13370947fa50d64e21e54ff (diff) | |
download | mariadb-git-11b8987313aab1eb8d9f829731fa0dcd83bf62f5.tar.gz |
Merge with 4.1.3-beta
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
VC++Files/libmysqld/libmysqld.dsp:
Auto merged
VC++Files/sql/mysqld.dsp:
Auto merged
client/mysql.cc:
Auto merged
client/mysqlbinlog.cc:
Auto merged
client/mysqltest.c:
Auto merged
include/config-netware.h:
Auto merged
include/my_base.h:
Auto merged
include/my_global.h:
Auto merged
include/my_sys.h:
Auto merged
include/mysql_com.h:
Auto merged
include/sql_state.h:
Auto merged
innobase/include/row0mysql.h:
Auto merged
innobase/row/row0sel.c:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
myisam/mi_check.c:
Auto merged
mysql-test/r/bdb.result:
Auto merged
mysql-test/r/connect.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/derived.result:
Auto merged
mysql-test/r/func_group.result:
Auto merged
mysql-test/r/func_like.result:
Auto merged
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/r/insert.result:
Auto merged
mysql-test/r/insert_select.result:
Auto merged
mysql-test/r/join_outer.result:
Auto merged
mysql-test/r/key.result:
Auto merged
mysql-test/r/multi_update.result:
Auto merged
mysql-test/r/mysqldump.result:
Auto merged
mysql-test/r/null.result:
Auto merged
mysql-test/r/null_key.result:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/r/rpl_rotate_logs.result:
Auto merged
mysql-test/r/rpl_server_id1.result:
Auto merged
mysql-test/r/rpl_until.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/show_check.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/system_mysql_db.result:
Auto merged
mysql-test/r/union.result:
Auto merged
mysql-test/r/variables.result:
Auto merged
mysql-test/t/multi_update.test:
Auto merged
mysql-test/t/mysqlbinlog.test:
Auto merged
mysql-test/t/rpl000015.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
mysys/mf_iocache2.c:
Auto merged
mysys/my_bitmap.c:
Auto merged
mysys/my_pthread.c:
Auto merged
netware/Makefile.am:
Auto merged
netware/my_manage.c:
Auto merged
netware/mysql_test_run.c:
Auto merged
netware/BUILD/compile-linux-tools:
Auto merged
netware/BUILD/compile-netware-standard:
Auto merged
netware/BUILD/mwenv:
Auto merged
netware/BUILD/nwbootstrap:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
scripts/mysql_install_db.sh:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_berkeley.h:
Auto merged
sql/ha_heap.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_create.h:
Auto merged
sql/item_func.h:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_sum.h:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/lex.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/net_serv.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/protocol.h:
Auto merged
sql/records.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_acl.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_derived.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/structs.h:
Auto merged
sql-common/client.c:
Auto merged
configure.in:
Merge with 4.1
include/mysqld_error.h:
New errors from 4.1
libmysqld/Makefile.am:
Merge with 4.1
myisam/myisamchk.c:
Merge with 4.1
myisam/myisamdef.h:
Merge with 4.1
myisam/sort.c:
Merge with 4.1
mysql-test/r/mysqlbinlog.result:
Merge with 4.1
mysql-test/r/range.result:
Merge with 4.1
mysql-test/r/rpl_flush_log_loop.result:
Merge with 4.1
mysql-test/r/rpl_replicate_do.result:
Merge with 4.1
mysql-test/r/rpl_temporary.result:
Merge with 4.1
mysql-test/r/rpl_user_variables.result:
Merge with 4.1
mysql-test/t/func_time.test:
Merge with 4.1
scripts/mysql_create_system_tables.sh:
Merge with 4.1
scripts/mysql_fix_privilege_tables.sql:
Merge with 4.1
sql/Makefile.am:
Merge with 4.1
sql/filesort.cc:
Merge with 4.1
sql/ha_innodb.cc:
Merge with 4.1
sql/ha_innodb.h:
Merge with 4.1
sql/ha_myisam.cc:
Merge with 4.1
sql/handler.cc:
Merge with 4.1
sql/handler.h:
Merge with 4.1
sql/item_func.cc:
Merge with 4.1
sql/item_timefunc.cc:
Merge with 4.1
sql/log.cc:
Merge with 4.1
sql/log_event.cc:
Merge with 4.1
sql/mysqld.cc:
Merge with 4.1
sql/opt_range.cc:
Merge with 4.1
sql/opt_range.h:
Merge with 4.1
sql/share/czech/errmsg.txt:
Merge with 4.1
Updated english error messages
sql/share/danish/errmsg.txt:
Merge with 4.1
sql/share/dutch/errmsg.txt:
Merge with 4.1
sql/share/english/errmsg.txt:
Merge with 4.1
sql/share/estonian/errmsg.txt:
Merge with 4.1
sql/share/french/errmsg.txt:
Merge with 4.1
sql/share/german/errmsg.txt:
Merge with 4.1
sql/share/greek/errmsg.txt:
Merge with 4.1
sql/share/hungarian/errmsg.txt:
Merge with 4.1
sql/share/italian/errmsg.txt:
Merge with 4.1
sql/share/japanese/errmsg.txt:
Merge with 4.1
sql/share/korean/errmsg.txt:
Merge with 4.1
sql/share/norwegian-ny/errmsg.txt:
Merge with 4.1
sql/share/norwegian/errmsg.txt:
Merge with 4.1
sql/share/polish/errmsg.txt:
Merge with 4.1
sql/share/portuguese/errmsg.txt:
Merge with 4.1
sql/share/romanian/errmsg.txt:
Merge with 4.1
sql/share/russian/errmsg.txt:
Merge with 4.1
sql/share/serbian/errmsg.txt:
Merge with 4.1
sql/share/slovak/errmsg.txt:
Merge with 4.1
sql/share/spanish/errmsg.txt:
Merge with 4.1
sql/share/swedish/errmsg.txt:
Merge with 4.1
sql/share/ukrainian/errmsg.txt:
Merge with 4.1
sql/slave.cc:
Merge with 4.1
sql/sql_class.cc:
Merge with 4.1
sql/sql_class.h:
Merge with 4.1
sql/sql_db.cc:
Merge with 4.1
sql/sql_insert.cc:
Merge with 4.1
sql/sql_lex.cc:
Merge with 4.1
sql/sql_lex.h:
Merge with 4.1
sql/sql_parse.cc:
Merge with 4.1 tree
Changed // comments to /* */
sql/sql_prepare.cc:
Merge with 4.1
sql/sql_select.cc:
Merge with 4.1
sql/sql_table.cc:
Merge with 4.1
sql/sql_yacc.yy:
Merge with 4.1
sql/table.h:
Merge with 4.1
tests/client_test.c:
Merge with 4.1
Diffstat (limited to 'netware')
-rwxr-xr-x | netware/BUILD/compile-linux-tools | 4 | ||||
-rwxr-xr-x | netware/BUILD/compile-netware-standard | 1 | ||||
-rwxr-xr-x | netware/BUILD/mwenv | 13 | ||||
-rwxr-xr-x | netware/BUILD/nwbootstrap | 12 | ||||
-rw-r--r-- | netware/Makefile.am | 29 | ||||
-rw-r--r-- | netware/init_db.sql | 13 | ||||
-rw-r--r-- | netware/my_manage.c | 5 | ||||
-rw-r--r-- | netware/mysql_fix_privilege_tables.pl | 121 | ||||
-rw-r--r-- | netware/mysql_test_run.c | 293 | ||||
-rw-r--r-- | netware/mysqld_safe.c | 616 | ||||
-rw-r--r-- | netware/static_init_db.sql | 4 |
11 files changed, 712 insertions, 399 deletions
diff --git a/netware/BUILD/compile-linux-tools b/netware/BUILD/compile-linux-tools index 886f866d674..70f07be649e 100755 --- a/netware/BUILD/compile-linux-tools +++ b/netware/BUILD/compile-linux-tools @@ -29,7 +29,7 @@ rm -f */*.linux ./configure --without-innodb --without-docs # build tools only -make clean config.h +make clean all-local (cd dbug; make libdbug.a) (cd strings; make libmystrings.a) (cd mysys; make libmysys.a) @@ -43,6 +43,8 @@ make clean config.h (cd extra; make comp_err) (cd libmysql; make conf_to_src) (cd libmysql_r; make conf_to_src) +# so the file will be linked +(cd sql; make sql_yacc.cc) (cd sql; make gen_lex_hash) (cd strings; make conf_to_src) diff --git a/netware/BUILD/compile-netware-standard b/netware/BUILD/compile-netware-standard index a21ea16a445..76a776a1da3 100755 --- a/netware/BUILD/compile-netware-standard +++ b/netware/BUILD/compile-netware-standard @@ -15,6 +15,7 @@ suffix="standard" extra_configs=" \ --with-innodb \ --enable-thread-safe-client \ + --with-archive-storage-engine \ " . $path/compile-netware-END diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv index 6f818b6f7a3..0acfd3aaf8f 100755 --- a/netware/BUILD/mwenv +++ b/netware/BUILD/mwenv @@ -1,13 +1,13 @@ #! /bin/sh -# WINE_BUILD_DIR, BUILD_DIR, and VERSION must be correct before compiling +# F:/mydev, /home/kp/mydev, and 4.0.21 must be correct before compiling # This values are normally changed by the nwbootstrap script # the default is "F:/mydev" -export MYDEV="WINE_BUILD_DIR" +export MYDEV="F:/mydev" -export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV;$MYDEV/zlib-1.1.4" -export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/mysql-VERSION/netware/BUILD" +export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.1.4;$MYDEV" +export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/openssl;$MYDEV/mysql-VERSION/netware/BUILD" export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp" export WINEPATH="$MYDEV/mw/bin" @@ -19,11 +19,10 @@ export AR='mwldnlm' export AR_FLAGS='-type library -o' export AS='mwasmnlm' export CC='mwccnlm -gccincludes' -export CFLAGS='-align 8 -proc 686 -relax_pointers -dialect c' +export CFLAGS='-O3 -align 8 -proc 686 -relax_pointers -dialect c' export CXX='mwccnlm -gccincludes' -export CXXFLAGS='-align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T' +export CXXFLAGS='-O3 -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T' export LD='mwldnlm' export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption' export RANLIB=: export STRIP=: - diff --git a/netware/BUILD/nwbootstrap b/netware/BUILD/nwbootstrap index f54775bf054..25e843c87e3 100755 --- a/netware/BUILD/nwbootstrap +++ b/netware/BUILD/nwbootstrap @@ -171,6 +171,16 @@ do rm $file.org done +# create the libmysql.imp file in netware folder from libmysql/libmysql.def +# file +echo "generating llibmysql.imp file..." +awk 'BEGIN{x=0;} x==1 {print $1;next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp + +# create the libmysql.imp file in netware folder from libmysql/libmysql.def file +echo "generating llibmysql.imp file..." +awk 'BEGIN{x=0;} x==1 {print $1;next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp + + # build linux tools echo "compiling linux tools..." ./netware/BUILD/compile-linux-tools @@ -183,5 +193,3 @@ then fi echo "done" - - diff --git a/netware/Makefile.am b/netware/Makefile.am index 1f0277ef20e..2467270f27b 100644 --- a/netware/Makefile.am +++ b/netware/Makefile.am @@ -14,7 +14,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +if HAVE_NETWARE INCLUDES = -I$(srcdir)/../include -I../include -I.. +LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ + ../dbug/libdbug.a ../strings/libmystrings.a bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql mysqld_safe_SOURCES= mysqld_safe.c my_manage.c mysql_install_db_SOURCES= mysql_install_db.c my_manage.c @@ -43,7 +46,31 @@ link_sources: org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \ @LN_CP_F@ $(srcdir)/$$org $(srcdir)/../$$f; \ done; - +else +EXTRA_DIST= comp_err.def init_db.sql install_test_db.ncf \ + isamchk.def isamlog.def libmysql.def libmysql.imp \ + libmysqlmain.c my_manage.c my_manage.h \ + my_print_defaults.def myisam_ftdump.def myisamchk.def \ + myisamlog.def myisampack.def mysql.def mysql.xdc \ + mysql_fix_privilege_tables.pl mysql_install.def \ + mysql_install_db.c mysql_install_db.def \ + mysql_secure_installation.pl mysql_test_run.c \ + mysql_test_run.def mysql_waitpid.def mysqladmin.def \ + mysqlbinlog.def mysqlcheck.def mysqld.def \ + mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \ + mysqlshow.def mysqltest.def pack_isam.def perror.def \ + replace.def resolve_stack_dump.def resolveip.def test_db.sql \ + static_init_db.sql \ + BUILD/apply-patch BUILD/compile-AUTOTOOLS \ + BUILD/compile-linux-tools BUILD/compile-netware-END \ + BUILD/compile-netware-START BUILD/compile-netware-all\ + BUILD/compile-netware-debug BUILD/compile-netware-max \ + BUILD/compile-netware-max-debug BUILD/compile-netware-src \ + BUILD/compile-netware-standard BUILD/create-patch \ + BUILD/cron-build BUILD/crontab BUILD/knetware.imp \ + BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \ + BUILD/nwbootstrap BUILD/openssl.imp BUILD/save-patch +endif # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/netware/init_db.sql b/netware/init_db.sql index 52e08333a93..5e7ace0779b 100644 --- a/netware/init_db.sql +++ b/netware/init_db.sql @@ -28,3 +28,16 @@ CREATE TABLE help_topic (help_topic_id int unsigned NOT NULL, name varchar(64) N 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)) 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)) 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)) 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)) DEFAULT CHARACTER SET latin1 comment='Time zone names'; +INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4); + +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)) DEFAULT CHARACTER SET latin1 comment='Time zones'; +INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'); +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)) DEFAULT CHARACTER SET latin1 comment='Time zone transitions'; +INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES(1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3) ,(1, 733280400, 2) ,(1, 749005200, 3) ,(1, 764730000, 2) ,(1, 780454800, 3) ,(1, 796179600, 2) ,(1, 811904400, 3) ,(1, 828234000, 2) ,(1, 846378000, 3) ,(1, 859683600, 2) ,(1, 877827600, 3) ,(1, 891133200, 2) ,(1, 909277200, 3) ,(1, 922582800, 2) ,(1, 941331600, 3) ,(1, 954032400, 2) ,(1, 972781200, 3) ,(1, 985482000, 2) ,(1, 1004230800, 3) ,(1, 1017536400, 2) ,(1, 1035680400, 3) ,(1, 1048986000, 2) ,(1, 1067130000, 3) ,(1, 1080435600, 2) ,(1, 1099184400, 3) ,(1, 1111885200, 2) ,(1, 1130634000, 3) ,(1, 1143334800, 2) ,(1, 1162083600, 3) ,(1, 1174784400, 2) ,(1, 1193533200, 3) ,(1, 1206838800, 2) ,(1, 1224982800, 3) ,(1, 1238288400, 2) ,(1, 1256432400, 3) ,(1, 1269738000, 2) ,(1, 1288486800, 3) ,(1, 1301187600, 2) ,(1, 1319936400, 3) ,(1, 1332637200, 2) ,(1, 1351386000, 3) ,(1, 1364691600, 2) ,(1, 1382835600, 3) ,(1, 1396141200, 2) ,(1, 1414285200, 3) ,(1, 1427590800, 2) ,(1, 1445734800, 3) ,(1, 1459040400, 2) ,(1, 1477789200, 3) ,(1, 1490490000, 2) ,(1, 1509238800, 3) ,(1, 1521939600, 2) ,(1, 1540688400, 3) ,(1, 1553994000, 2) ,(1, 1572138000, 3) ,(1, 1585443600, 2) ,(1, 1603587600, 3) ,(1, 1616893200, 2) ,(1, 1635642000, 3) ,(1, 1648342800, 2) ,(1, 1667091600, 3) ,(1, 1679792400, 2) ,(1, 1698541200, 3) ,(1, 1711846800, 2) ,(1, 1729990800, 3) ,(1, 1743296400, 2) ,(1, 1761440400, 3) ,(1, 1774746000, 2) ,(1, 1792890000, 3) ,(1, 1806195600, 2) ,(1, 1824944400, 3) ,(1, 1837645200, 2) ,(1, 1856394000, 3) ,(1, 1869094800, 2) ,(1, 1887843600, 3) ,(1, 1901149200, 2) ,(1, 1919293200, 3) ,(1, 1932598800, 2) ,(1, 1950742800, 3) ,(1, 1964048400, 2) ,(1, 1982797200, 3) ,(1, 1995498000, 2) ,(1, 2014246800, 3) ,(1, 2026947600, 2) ,(1, 2045696400, 3) ,(1, 2058397200, 2) ,(1, 2077146000, 3) ,(1, 2090451600, 2) ,(1, 2108595600, 3) ,(1, 2121901200, 2) ,(1, 2140045200, 3) ,(3, -1688265000, 2) ,(3, -1656819048, 1) ,(3, -1641353448, 2) ,(3, -1627965048, 3) ,(3, -1618716648, 1) ,(3, -1596429048, 3) ,(3, -1593829848, 5) ,(3, -1589860800, 4) ,(3, -1542427200, 5) ,(3, -1539493200, 6) ,(3, -1525323600, 5) ,(3, -1522728000, 4) ,(3, -1491188400, 7) ,(3, -1247536800, 4) ,(3, 354920400, 5) ,(3, 370728000, 4) ,(3, 386456400, 5) ,(3, 402264000, 4) ,(3, 417992400, 5) ,(3, 433800000, 4) ,(3, 449614800, 5) ,(3, 465346800, 8) ,(3, 481071600, 9) ,(3, 496796400, 8) ,(3, 512521200, 9) ,(3, 528246000, 8) ,(3, 543970800, 9) ,(3, 559695600, 8) ,(3, 575420400, 9) ,(3, 591145200, 8) ,(3, 606870000, 9) ,(3, 622594800, 8) ,(3, 638319600, 9) ,(3, 654649200, 8) ,(3, 670374000, 10) ,(3, 686102400, 11) ,(3, 695779200, 8) ,(3, 701812800, 5) ,(3, 717534000, 4) ,(3, 733273200, 9) ,(3, 748998000, 8) ,(3, 764722800, 9) ,(3, 780447600, 8) ,(3, 796172400, 9) ,(3, 811897200, 8) ,(3, 828226800, 9) ,(3, 846370800, 8) ,(3, 859676400, 9) ,(3, 877820400, 8) ,(3, 891126000, 9) ,(3, 909270000, 8) ,(3, 922575600, 9) ,(3, 941324400, 8) ,(3, 954025200, 9) ,(3, 972774000, 8) ,(3, 985474800, 9) ,(3, 1004223600, 8) ,(3, 1017529200, 9) ,(3, 1035673200, 8) ,(3, 1048978800, 9) ,(3, 1067122800, 8) ,(3, 1080428400, 9) ,(3, 1099177200, 8) ,(3, 1111878000, 9) ,(3, 1130626800, 8) ,(3, 1143327600, 9) ,(3, 1162076400, 8) ,(3, 1174777200, 9) ,(3, 1193526000, 8) ,(3, 1206831600, 9) ,(3, 1224975600, 8) ,(3, 1238281200, 9) ,(3, 1256425200, 8) ,(3, 1269730800, 9) ,(3, 1288479600, 8) ,(3, 1301180400, 9) ,(3, 1319929200, 8) ,(3, 1332630000, 9) ,(3, 1351378800, 8) ,(3, 1364684400, 9) ,(3, 1382828400, 8) ,(3, 1396134000, 9) ,(3, 1414278000, 8) ,(3, 1427583600, 9) ,(3, 1445727600, 8) ,(3, 1459033200, 9) ,(3, 1477782000, 8) ,(3, 1490482800, 9) ,(3, 1509231600, 8) ,(3, 1521932400, 9) ,(3, 1540681200, 8) ,(3, 1553986800, 9) ,(3, 1572130800, 8) ,(3, 1585436400, 9) ,(3, 1603580400, 8) ,(3, 1616886000, 9) ,(3, 1635634800, 8) ,(3, 1648335600, 9) ,(3, 1667084400, 8) ,(3, 1679785200, 9) ,(3, 1698534000, 8) ,(3, 1711839600, 9) ,(3, 1729983600, 8) ,(3, 1743289200, 9) ,(3, 1761433200, 8) ,(3, 1774738800, 9) ,(3, 1792882800, 8) ,(3, 1806188400, 9) ,(3, 1824937200, 8) ,(3, 1837638000, 9) ,(3, 1856386800, 8) ,(3, 1869087600, 9) ,(3, 1887836400, 8) ,(3, 1901142000, 9) ,(3, 1919286000, 8) ,(3, 1932591600, 9) ,(3, 1950735600, 8) ,(3, 1964041200, 9) ,(3, 1982790000, 8) ,(3, 1995490800, 9) ,(3, 2014239600, 8) ,(3, 2026940400, 9) ,(3, 2045689200, 8) ,(3, 2058390000, 9) ,(3, 2077138800, 8) ,(3, 2090444400, 9) ,(3, 2108588400, 8) ,(3, 2121894000, 9) ,(3, 2140038000, 8) ,(4, -1688265000, 2) ,(4, -1656819048, 1) ,(4, -1641353448, 2) ,(4, -1627965048, 3) ,(4, -1618716648, 1) ,(4, -1596429048, 3) ,(4, -1593829848, 5) ,(4, -1589860800, 4) ,(4, -1542427200, 5) ,(4, -1539493200, 6) ,(4, -1525323600, 5) ,(4, -1522728000, 4) ,(4, -1491188400, 7) ,(4, -1247536800, 4) ,(4, 354920409, 5) ,(4, 370728010, 4) ,(4, 386456410, 5) ,(4, 402264011, 4) ,(4, 417992411, 5) ,(4, 433800012, 4) ,(4, 449614812, 5) ,(4, 465346812, 8) ,(4, 481071612, 9) ,(4, 496796413, 8) ,(4, 512521213, 9) ,(4, 528246013, 8) ,(4, 543970813, 9) ,(4, 559695613, 8) ,(4, 575420414, 9) ,(4, 591145214, 8) ,(4, 606870014, 9) ,(4, 622594814, 8) ,(4, 638319615, 9) ,(4, 654649215, 8) ,(4, 670374016, 10) ,(4, 686102416, 11) ,(4, 695779216, 8) ,(4, 701812816, 5) ,(4, 717534017, 4) ,(4, 733273217, 9) ,(4, 748998018, 8) ,(4, 764722818, 9) ,(4, 780447619, 8) ,(4, 796172419, 9) ,(4, 811897219, 8) ,(4, 828226820, 9) ,(4, 846370820, 8) ,(4, 859676420, 9) ,(4, 877820421, 8) ,(4, 891126021, 9) ,(4, 909270021, 8) ,(4, 922575622, 9) ,(4, 941324422, 8) ,(4, 954025222, 9) ,(4, 972774022, 8) ,(4, 985474822, 9) ,(4, 1004223622, 8) ,(4, 1017529222, 9) ,(4, 1035673222, 8) ,(4, 1048978822, 9) ,(4, 1067122822, 8) ,(4, 1080428422, 9) ,(4, 1099177222, 8) ,(4, 1111878022, 9) ,(4, 1130626822, 8) ,(4, 1143327622, 9) ,(4, 1162076422, 8) ,(4, 1174777222, 9) ,(4, 1193526022, 8) ,(4, 1206831622, 9) ,(4, 1224975622, 8) ,(4, 1238281222, 9) ,(4, 1256425222, 8) ,(4, 1269730822, 9) ,(4, 1288479622, 8) ,(4, 1301180422, 9) ,(4, 1319929222, 8) ,(4, 1332630022, 9) ,(4, 1351378822, 8) ,(4, 1364684422, 9) ,(4, 1382828422, 8) ,(4, 1396134022, 9) ,(4, 1414278022, 8) ,(4, 1427583622, 9) ,(4, 1445727622, 8) ,(4, 1459033222, 9) ,(4, 1477782022, 8) ,(4, 1490482822, 9) ,(4, 1509231622, 8) ,(4, 1521932422, 9) ,(4, 1540681222, 8) ,(4, 1553986822, 9) ,(4, 1572130822, 8) ,(4, 1585436422, 9) ,(4, 1603580422, 8) ,(4, 1616886022, 9) ,(4, 1635634822, 8) ,(4, 1648335622, 9) ,(4, 1667084422, 8) ,(4, 1679785222, 9) ,(4, 1698534022, 8) ,(4, 1711839622, 9) ,(4, 1729983622, 8) ,(4, 1743289222, 9) ,(4, 1761433222, 8) ,(4, 1774738822, 9) ,(4, 1792882822, 8) ,(4, 1806188422, 9) ,(4, 1824937222, 8) ,(4, 1837638022, 9) ,(4, 1856386822, 8) ,(4, 1869087622, 9) ,(4, 1887836422, 8) ,(4, 1901142022, 9) ,(4, 1919286022, 8) ,(4, 1932591622, 9) ,(4, 1950735622, 8) ,(4, 1964041222, 9) ,(4, 1982790022, 8) ,(4, 1995490822, 9) ,(4, 2014239622, 8) ,(4, 2026940422, 9) ,(4, 2045689222, 8) ,(4, 2058390022, 9) ,(4, 2077138822, 8) ,(4, 2090444422, 9) ,(4, 2108588422, 8) ,(4, 2121894022, 9) ,(4, 2140038022, 8); + +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)) DEFAULT CHARACTER SET latin1 comment='Time zone transition types'; +INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET'),(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET'),(2, 0, 0, 0, 'UTC'),(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST'),(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST'),(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD'),(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET'),(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD'),(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET'),(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST'),(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST'),(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD'),(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET'),(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD'),(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET'); +CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) DEFAULT CHARACTER SET latin1 comment='Leap seconds information for time zones'; +INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3),(157766403, 4) ,(189302404, 5) ,(220924805, 6),(252460806, 7) ,(283996807, 8) ,(315532808, 9),(362793609, 10) ,(394329610, 11) ,(425865611, 12),(489024012, 13) ,(567993613, 14) ,(631152014, 15),(662688015, 16) ,(709948816, 17) ,(741484817, 18),(773020818, 19) ,(820454419, 20) ,(867715220, 21),(915148821, 22); diff --git a/netware/my_manage.c b/netware/my_manage.c index f5aa3163431..29514837837 100644 --- a/netware/my_manage.c +++ b/netware/my_manage.c @@ -200,11 +200,11 @@ int wait_for_server_start(char *bin_dir, char *user, char *password, int port,ch add_arg(&al, "--password=%s", password); add_arg(&al, "--silent"); - /** Not supported on NetWare +#ifdef NOT_USED add_arg(&al, "-O"); add_arg(&al, "connect_timeout=10"); add_arg(&al, "-w"); - **/ +#endif add_arg(&al, "--host=localhost"); add_arg(&al, "ping"); @@ -475,4 +475,3 @@ void get_basedir(char *argv0, char *basedir) strcpy(basedir, temp); } } - diff --git a/netware/mysql_fix_privilege_tables.pl b/netware/mysql_fix_privilege_tables.pl index fd5bc11dde1..c0a428eff0f 100644 --- a/netware/mysql_fix_privilege_tables.pl +++ b/netware/mysql_fix_privilege_tables.pl @@ -1,16 +1,16 @@ #----------------------------------------------------------------------------- # Copyright (C) 2002 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; either version 2 of the License, or # (at your option) any later version. -# +# # 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 @@ -19,7 +19,7 @@ #----------------------------------------------------------------------------- # This notice applies to changes, created by or for Novell, Inc., # to preexisting works for which notices appear elsewhere in this file. - + # Copyright (c) 2003 Novell, Inc. All Rights Reserved. # This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #----------------------------------------------------------------------------- -use strict; +#use strict; use Mysql; print "MySQL Fix Privilege Tables Script\n\n"; @@ -63,12 +63,27 @@ my $conn = Mysql->connect("localhost", "mysql", "root", $password) || die "Unable to connect to MySQL."; print "OK, successfully used the password, moving on...\n\n"; - - + + #----------------------------------------------------------------------------- # MySQL 4.0.2 #----------------------------------------------------------------------------- +#-- Detect whether or not we had the Grant_priv column +print "Fixing privileges for old tables...\n"; +$conn->query("SET \@hadGrantPriv:=0;"); +$conn->query("SELECT \@hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';"); + +#--- Fix privileges for old tables +$conn->query("UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); +$conn->query("UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); +$conn->query("UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); + + +# Detect whether we had Show_db_priv +$conn->query("SET \@hadShowDbPriv:=0;"); +$conn->query("SELECT \@hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';"); + print "Adding new fields used by MySQL 4.0.2 to the privilege tables...\n"; print "NOTE: You can ignore any Duplicate column errors.\n"; $conn->query(" \ @@ -81,9 +96,11 @@ ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, \ ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, \ ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; \ ") && $conn->query(" \ -UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''; \ +UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''AND \@hadShowDbPriv = 0; \ "); +#-- The above statement converts privileges so that users have similar privileges as before + #----------------------------------------------------------------------------- # MySQL 4.0 Limitations #----------------------------------------------------------------------------- @@ -97,6 +114,22 @@ ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, \ ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; \ "); +#-- Change the password column to suite the new password hashing used +#-- in 4.1.1 onward +$conn->query("ALTER TABLE user change Password Password char(41) binary not null;"); + +#-- The second alter changes ssl_type to new 4.0.2 format +#-- Adding columns needed by GRANT .. REQUIRE (openssl)" +print "Adding new fields to use in ssl authentication...\n"; + +$conn->query(" \ +ALTER TABLE user \ +ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, \ +ADD ssl_cipher BLOB NOT NULL, \ +ADD x509_issuer BLOB NOT NULL, \ +ADD x509_subject BLOB NOT NULL; \ +"); + #----------------------------------------------------------------------------- # MySQL 4.0 DB and Host privs #----------------------------------------------------------------------------- @@ -115,6 +148,77 @@ ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \ ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ "); +# +# Change the Table_name column to be of char(64) which was char(60) by mistake till now. +# +$conn->query("alter table tables_priv change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;"); + + +# +# Create some possible missing tables +# +print "Adding online help tables...\n"; + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS 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) \ +) comment='help topics'; \ +"); + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS 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) \ +) comment='help categories'; \ +"); + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS 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) \ +) comment='keyword-topic relation'; \ +"); + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS help_keyword ( \ +help_keyword_id int unsigned not null, \ +name varchar(64) not null, \ +primary key (help_keyword_id), \ +unique index (name) \ +) comment='help keywords'; \ +"); + + +# +# Filling the help tables with contents. +# +print "Filling online help tables with contents...\n"; +# Generate the path for "fill_help_tables.sql" file which is in different folder. +$fill_help_table=$0; +$fill_help_table =~ s/scripts[\\\/]mysql_fix_privilege_tables.pl/support-files\\fill_help_tables.sql/; + +#read all content from the sql file which contains recordsfor help tables. +open(fileIN,$fill_help_table) or die("Cannot open $fill_help_table: $!"); +@logData = <fileIN>; +close(fileIN); +foreach $line (@logData) { +# if the line is not empty, insert a record in the table. + if( ! ($line =~ /^\s*$/) ) { + $conn->query("$line"); + } +} + #----------------------------------------------------------------------------- # done #----------------------------------------------------------------------------- @@ -122,4 +226,3 @@ ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ print "\n\nAll done!\n\n"; print "Thanks for using MySQL!\n\n"; - diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c index 06d5e5985c1..a69c5015968 100644 --- a/netware/mysql_test_run.c +++ b/netware/mysql_test_run.c @@ -16,22 +16,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> +#include <my_global.h> +#include <m_string.h> #include <dirent.h> -#include <string.h> #include <screen.h> #include <nks/vm.h> #include <ctype.h> #include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> #include <sys/mode.h> - -#include "my_config.h" #include "my_manage.h" - /****************************************************************************** macros @@ -148,11 +141,12 @@ int read_option(char *, char *); void run_test(char *); void setup(char *); void vlog(char *, va_list); -void log(char *, ...); +void log_msg(char *, ...); void log_info(char *, ...); void log_error(char *, ...); void log_errno(char *, ...); void die(char *); +char *str_tok(char *string, const char *delim); /****************************************************************************** @@ -165,21 +159,21 @@ void report_stats() { if (total_fail == 0) { - log("\nAll %d test(s) were successful.\n", total_test); + log_msg("\nAll %d test(s) were successful.\n", total_test); } else { double percent = ((double)total_pass / total_test) * 100; - log("\nFailed %u/%u test(s), %.02f%% successful.\n", + log_msg("\nFailed %u/%u test(s), %.02f%% successful.\n", total_fail, total_test, percent); - log("\nThe .out and .err files in %s may give you some\n", result_dir); - log("hint of what when wrong.\n"); - log("\nIf you want to report this error, please first read the documentation\n"); - log("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); + log_msg("\nThe .out and .err files in %s may give you some\n", result_dir); + log_msg("hint of what when wrong.\n"); + log_msg("\nIf you want to report this error, please first read the documentation\n"); + log_msg("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); } - log("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60); + log_msg("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60); } /****************************************************************************** @@ -244,6 +238,7 @@ void mysql_install_db() mkdir(temp, S_IRWXU); // create subdirectories + log_msg("Creating test-suite folders...\n"); snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); mkdir(temp, S_IRWXU); snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); @@ -262,7 +257,9 @@ void mysql_install_db() mkdir(temp, S_IRWXU); // install databases + log_msg("Creating test databases for master... \n"); install_db(master_dir); + log_msg("Creating test databases for slave... \n"); install_db(slave_dir); } @@ -346,6 +343,9 @@ void start_master() add_arg(&al, "--character-sets-dir=%s", char_dir); add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); add_arg(&al, "--language=%s", lang_dir); +#ifdef DEBUG //only for debug builds + add_arg(&al, "--debug"); +#endif if (use_openssl) { @@ -370,33 +370,28 @@ void start_master() if (master_opt[0] != NULL) { char *p; - char *temp; - - p = (char *)strtok(master_opt, " \t"); - if ((temp = strstr(p, "timezone")) == NULL) + p = (char *)str_tok(master_opt, " \t"); + if (!strstr(master_opt, "timezone")) { - while(p) + while (p) { add_arg(&al, "%s", p); - p = (char *)strtok(NULL, " \t"); + p = (char *)str_tok(NULL, " \t"); } } - else - { - //do nothing - } } // remove the pid file if it exists remove(master_pid); // spawn - if ((err = spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0) + if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0) { sleep_until_file_exists(master_pid); - if ((err = wait_for_server_start(bin_dir, user, password, master_port,mysql_tmp_dir)) == 0) + if ((err = wait_for_server_start(bin_dir, user, password, master_port, + mysql_tmp_dir)) == 0) { master_running = TRUE; } @@ -467,11 +462,11 @@ void start_slave() snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); fp = fopen(temp, "wb+"); - fputs("master-bin.001\n", fp); + fputs("master-bin.000001\n", fp); fputs("4\n", fp); fputs("127.0.0.1\n", fp); fputs("replicate\n", fp); - fputs("aaaaaaaaaaaaaaabthispartofthepasswordisnotused\n", fp); + fputs("aaaaaaaaaaaaaaab\n", fp); fputs("9306\n", fp); fputs("1\n", fp); fputs("0\n", fp); @@ -521,6 +516,9 @@ void start_slave() add_arg(&al, "--master-retry-count=10"); add_arg(&al, "-O"); add_arg(&al, "slave_net_timeout=10"); +#ifdef DEBUG //only for debug builds + add_arg(&al, "--debug"); +#endif if (use_openssl) { @@ -534,13 +532,13 @@ void start_slave() { char *p; - p = (char *)strtok(slave_master_info, " \t"); + p = (char *)str_tok(slave_master_info, " \t"); while(p) { add_arg(&al, "%s", p); - p = (char *)strtok(NULL, " \t"); + p = (char *)str_tok(NULL, " \t"); } } else @@ -567,13 +565,13 @@ void start_slave() { char *p; - p = (char *)strtok(slave_opt, " \t"); + p = (char *)str_tok(slave_opt, " \t"); while(p) { add_arg(&al, "%s", p); - p = (char *)strtok(NULL, " \t"); + p = (char *)str_tok(NULL, " \t"); } } @@ -585,18 +583,22 @@ void start_slave() { sleep_until_file_exists(slave_pid); - if ((err = wait_for_server_start(bin_dir, user, password, slave_port,mysql_tmp_dir)) == 0) + if ((err = wait_for_server_start(bin_dir, user, password, slave_port, + mysql_tmp_dir)) == 0) { slave_running = TRUE; + } else { log_error("The slave server went down early."); + } } else { log_error("Unable to start slave server."); + } // free args @@ -636,7 +638,8 @@ void stop_slave() if (!slave_running) return; // stop - if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid,mysql_tmp_dir)) == 0) + if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid, + mysql_tmp_dir)) == 0) { slave_running = FALSE; } @@ -660,7 +663,8 @@ void stop_master() // running? if (!master_running) return; - if ((err = stop_server(bin_dir, user, password, master_port, master_pid,mysql_tmp_dir)) == 0) + if ((err = stop_server(bin_dir, user, password, master_port, master_pid, + mysql_tmp_dir)) == 0) { master_running = FALSE; } @@ -697,6 +701,7 @@ void mysql_stop() ******************************************************************************/ void mysql_restart() { + log_info("Restarting the MySQL server(s): %u", ++restarts); mysql_stop(); @@ -758,6 +763,12 @@ int read_option(char *opt_file, char *opt) strcat(opt, temp); } + // Check for double backslash and replace it with single bakslash + if ((p = strstr(opt, "\\\\")) != NULL) + { + /* bmove is guranteed to work byte by byte */ + bmove(p, p+1, strlen(p+1)); + } } else { @@ -786,20 +797,16 @@ void run_test(char *test) int flag = FALSE; struct stat info; - // single test? -// if (!single_test) - { - // skip tests in the skip list - snprintf(temp, PATH_MAX, " %s ", test); - skip = (strindex(skip_test, temp) != NULL); - if( skip == FALSE ) - ignore = (strindex(ignore_test, temp) != NULL); - } + // skip tests in the skip list + snprintf(temp, PATH_MAX, " %s ", test); + skip = (strindex(skip_test, temp) != NULL); + if (skip == FALSE) + ignore = (strindex(ignore_test, temp) != NULL); - if(ignore) + if (ignore) { // show test - log("%-46s ", test); + log_msg("%-46s ", test); // ignore rstr = TEST_IGNORE; @@ -837,7 +844,7 @@ void run_test(char *test) if (stat(test_file, &info)) { snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX); - if(access(test_file,0)) + if (access(test_file,0)) { printf("Invalid test name %s, %s file not found\n",test,test_file); return; @@ -881,7 +888,7 @@ void run_test(char *test) sleep(1); // show test - log("%-46s ", test); + log_msg("%-46s ", test); // args init_args(&al); @@ -953,7 +960,7 @@ void run_test(char *test) else // early skips { // show test - log("%-46s ", test); + log_msg("%-46s ", test); // skip rstr = TEST_SKIP; @@ -961,7 +968,7 @@ void run_test(char *test) } // result - log("%10.06f %-14s\n", elapsed, rstr); + log_msg("%10.06f %-14s\n", elapsed, rstr); } /****************************************************************************** @@ -990,7 +997,7 @@ void vlog(char *format, va_list ap) Log the message. ******************************************************************************/ -void log(char *format, ...) +void log_msg(char *format, ...) { va_list ap; @@ -1014,9 +1021,9 @@ void log_info(char *format, ...) va_start(ap, format); - log("-- INFO : "); + log_msg("-- INFO : "); vlog(format, ap); - log("\n"); + log_msg("\n"); va_end(ap); } @@ -1034,9 +1041,9 @@ void log_error(char *format, ...) va_start(ap, format); - log("-- ERROR: "); + log_msg("-- ERROR: "); vlog(format, ap); - log("\n"); + log_msg("\n"); va_end(ap); } @@ -1054,9 +1061,9 @@ void log_errno(char *format, ...) va_start(ap, format); - log("-- ERROR: (%003u) ", errno); + log_msg("-- ERROR: (%003u) ", errno); vlog(format, ap); - log("\n"); + log_msg("\n"); va_end(ap); } @@ -1087,8 +1094,7 @@ void die(char *msg) void setup(char *file) { char temp[PATH_MAX]; - char mysqldump_load[PATH_MAX*2],mysqlbinlog_load[PATH_MAX*2]; - + char file_path[PATH_MAX*2]; char *p; // set the timezone for the timestamp test @@ -1145,13 +1151,16 @@ void setup(char *file) strcpy(temp, strlwr(skip_test)); snprintf(skip_test, PATH_MAX, " %s ", temp); - snprintf(mysqlbinlog_load,PATH_MAX*2,"%s/mysqlbinlog --no-defaults --local-load=%s",bin_dir,mysql_tmp_dir); - snprintf(mysqldump_load,PATH_MAX*2,"%s/mysqldump --no-defaults -uroot --port=%d",bin_dir,master_port); // environment setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - setenv("MYSQL_DUMP", mysqldump_load, 1); - setenv("MYSQL_BINLOG", mysqlbinlog_load, 1); + snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port); + setenv("MYSQL_DUMP", file_path, 1); + snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + setenv("MYSQL_BINLOG", file_path, 1); setenv("MASTER_MYPORT", "9306", 1); + setenv("SLAVE_MYPORT", "9307", 1); + setenv("MYSQL_TCP_PORT", "3306", 1); + } /****************************************************************************** @@ -1165,20 +1174,22 @@ int main(int argc, char **argv) // setup setup(argv[0]); - /* The --ignore option is comma saperated list of test cases to skip and should - * be very first command line option to the test suite. - * The usage is now: - * mysql_test_run --ignore=test1,test2 test3 test4 - * where test1 and test2 are test cases to ignore - * and test3 and test4 are test cases to run. */ - if( argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1) ) + /* The --ignore option is comma saperated list of test cases to skip and + should be very first command line option to the test suite. + + The usage is now: + mysql_test_run --ignore=test1,test2 test3 test4 + where test1 and test2 are test cases to ignore + and test3 and test4 are test cases to run. + */ + if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) { char *temp, *token; - temp=strdup(strchr(argv[1],'=') + 1); - for(token=strtok(temp, ","); token != NULL; token=strtok(NULL, ",")) + temp= strdup(strchr(argv[1],'=') + 1); + for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ",")) { - if( strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1 ) - sprintf( ignore_test+strlen(ignore_test), " %s ", token); + if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1) + sprintf(ignore_test+strlen(ignore_test), " %s ", token); else { free(temp); @@ -1189,18 +1200,18 @@ int main(int argc, char **argv) is_ignore_list = 1; } // header - log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); + log_msg("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); - log("Initializing Tests...\n"); + log_msg("Initializing Tests...\n"); // install test databases mysql_install_db(); - log("Starting Tests...\n"); + log_msg("Starting Tests...\n"); - log("\n"); - log(HEADER); - log(DASH); + log_msg("\n"); + log_msg(HEADER); + log_msg(DASH); if ( argc > 1 + is_ignore_list ) { @@ -1255,10 +1266,10 @@ int main(int argc, char **argv) // stop server mysql_stop(); - log(DASH); - log("\n"); + log_msg(DASH); + log_msg("\n"); - log("Ending Tests...\n"); + log_msg("Ending Tests...\n"); // report stats report_stats(); @@ -1272,3 +1283,113 @@ int main(int argc, char **argv) return 0; } +/* + Synopsis: + This function breaks the string into a sequence of tokens. The difference + between this function and strtok is that it respects the quoted string i.e. + it skips any delimiter character within the quoted part of the string. + It return tokens by eliminating quote character. It modifies the input string + passed. It will work with whitespace delimeter but may not work properly with + other delimeter. If the delimeter will contain any quote character, then + function will not tokenize and will return null string. + e.g. if input string is + --init-slave="set global max_connections=500" --skip-external-locking + then the output will two string i.e. + --init-slave=set global max_connections=500 + --skip-external-locking + +Arguments: + string: input string + delim: set of delimiter character +Output: + return the null terminated token of NULL. +*/ + + +char *str_tok(char *string, const char *delim) +{ + char *token; /* current token received from strtok */ + char *qt_token; /* token delimeted by the matching pair of quote */ + /* + if there are any quote chars found in the token then this variable + will hold the concatenated string to return to the caller + */ + char *ptr_token=NULL; + /* pointer to the quote character in the token from strtok */ + char *ptr_quote=NULL; + + /* See if the delimeter contains any quote character */ + if (strchr(delim,'\'') || strchr(delim,'\"')) + return NULL; + + /* repeate till we are getting some token from strtok */ + while ((token = (char*)strtok(string, delim) ) != NULL) + { + /* + make the input string NULL so that next time onward strtok can + be called with NULL input string. + */ + string = NULL; + + /* check if the current token contain double quote character*/ + if ((ptr_quote = (char*)strchr(token,'\"')) != NULL) + { + /* + get the matching the matching double quote in the remaining + input string + */ + qt_token = (char*)strtok(NULL,"\""); + } + /* check if the current token contain single quote character*/ + else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL) + { + /* + get the matching the matching single quote in the remaining + input string + */ + qt_token = (char*)strtok(NULL,"\'"); + } + + /* + if the current token does not contains any quote character then + return to the caller. + */ + if (ptr_quote == NULL) + { + /* + if there is any earlier token i.e. ptr_token then append the + current token in it and return it else return the current + token directly + */ + return ptr_token ? strcat(ptr_token,token) : token; + } + + /* + remove the quote character i.e. make NULL so that the token will + be devided in two part and later both part can be concatenated + and hence quote will be removed + */ + *ptr_quote= 0; + + /* check if ptr_token has been initialized or not */ + if (ptr_token == NULL) + { + /* initialize the ptr_token with current token */ + ptr_token= token; + /* copy entire string between matching pair of quote*/ + sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token); + } + else + { + /* + copy the current token and entire string between matching pair + of quote + */ + sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, + qt_token ); + } + } + + /* return the concatenated token */ + return ptr_token; +} diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c index a815497ac0f..a307b52bb7e 100644 --- a/netware/mysqld_safe.c +++ b/netware/mysqld_safe.c @@ -1,20 +1,20 @@ /*
- Copyright (c) 2003 Novell, Inc. All Rights Reserved.
+ Copyright (c) 2003 Novell, Inc. All Rights Reserved. - 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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.
+ 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; either version 2 of the License, or + (at your option) any later version. + + 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
+ 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
-*/
+*/ #include <stdlib.h>
#include <stdio.h>
@@ -32,7 +32,7 @@ /******************************************************************************
global variables
-
+ ******************************************************************************/
char autoclose;
char basedir[PATH_MAX];
@@ -47,37 +47,38 @@ char mysqld[PATH_MAX]; char hostname[PATH_MAX];
char default_option[PATH_MAX];
-FILE *log_fd = NULL;
+FILE *log_fd= NULL; /******************************************************************************
prototypes
-
+ ******************************************************************************/
void usage(void); void vlog(char *, va_list);
void log(char *, ...);
-void start_defaults(int, char*[]);
+void start_defaults(int, char *[]); void finish_defaults();
void read_defaults(arg_list_t *); -void parse_args(int, char*[]);
-void get_options(int, char*[]);
+void parse_args(int, char *[]); +void get_options(int, char *[]); void check_data_vol();
void check_setup();
void check_tables();
-void mysql_start(int, char*[]);
+void mysql_start(int, char *[]); +void parse_setvar(char *arg); /******************************************************************************
functions
-
+ ******************************************************************************/
/******************************************************************************
usage() - + Show usage. ******************************************************************************/ @@ -85,7 +86,7 @@ void usage(void) { // keep the screen up setscreenmode(SCR_NO_MODE); - + puts("\ \n\ usage: mysqld_safe [options]\n\ @@ -106,14 +107,14 @@ options:\n\ --mysqld=<file> Use the <file> MySQL daemon.\n\ \n\ "); - + exit(-1); } /****************************************************************************** vlog()
-
+ Log the message.
******************************************************************************/
@@ -121,7 +122,7 @@ void vlog(char *format, va_list ap) {
vfprintf(stdout, format, ap);
fflush(stdout);
-
+ if (log_fd)
{
vfprintf(log_fd, format, ap);
@@ -132,25 +133,25 @@ void vlog(char *format, va_list ap) /******************************************************************************
log()
-
+ Log the message.
******************************************************************************/
void log(char *format, ...)
{
va_list ap;
-
+ va_start(ap, format);
vlog(format, ap);
-
+ va_end(ap);
}
/******************************************************************************
start_defaults()
-
+ Start setting the defaults.
******************************************************************************/
@@ -158,30 +159,30 @@ void start_defaults(int argc, char *argv[]) {
struct stat buf;
int i;
-
+ // default options
- static char *default_options[] =
+ static char *default_options[]= {
- "--no-defaults",
- "--defaults-file=",
- "--defaults-extra-file=",
- NULL
+ "--no-defaults", + "--defaults-file=", + "--defaults-extra-file=", + NULL };
-
+ // autoclose
- autoclose = FALSE;
-
+ autoclose= FALSE; + // basedir
get_basedir(argv[0], basedir);
-
+ // check-tables - checktables = FALSE; - + checktables= FALSE; + // hostname
- if (gethostname(hostname,PATH_MAX) < 0)
+ if (gethostname(hostname, PATH_MAX) < 0) {
// default
- strcpy(hostname,"mysql");
+ strcpy(hostname, "mysql"); }
// address
@@ -189,30 +190,30 @@ void start_defaults(int argc, char *argv[]) // port
snprintf(port, PATH_MAX, "3306");
-
+ // default option
- default_option[0] = NULL;
- for (i=0; (argc > 1) && default_options[i]; i++)
- {
- if(!strnicmp(argv[1], default_options[i], strlen(default_options[i])))
- {
- strncpy(default_option, argv[1], PATH_MAX);
- break;
- }
- }
-
+ default_option[0]= NULL; + for (i= 0; (argc > 1) && default_options[i]; i++) + { + if (!strnicmp(argv[1], default_options[i], strlen(default_options[i]))) + { + strncpy(default_option, argv[1], PATH_MAX); + break; + } + } + // set after basedir is established
- datadir[0] = NULL;
- pid_file[0] = NULL;
- err_log[0] = NULL;
- safe_log[0] = NULL;
- mysqld[0] = NULL;
+ datadir[0]= NULL; + pid_file[0]= NULL; + err_log[0]= NULL; + safe_log[0]= NULL; + mysqld[0]= NULL; }
/******************************************************************************
finish_defaults()
-
+ Finish settig the defaults.
******************************************************************************/
@@ -220,22 +221,27 @@ void finish_defaults() {
struct stat buf;
int i;
-
+ // datadir
- if (!datadir[0]) snprintf(datadir, PATH_MAX, "%s/data", basedir);
-
+ if (!datadir[0]) + snprintf(datadir, PATH_MAX, "%s/data", basedir); + // pid-file
- if (!pid_file[0]) snprintf(pid_file, PATH_MAX, "%s/%s.pid", datadir, hostname);
-
+ if (!pid_file[0]) + snprintf(pid_file, PATH_MAX, "%s/%s.pid", datadir, hostname); + // err-log
- if (!err_log[0]) snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname);
+ if (!err_log[0]) + snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname); // safe-log
- if (!safe_log[0]) snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname); + if (!safe_log[0]) + snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname); // mysqld
- if (!mysqld[0]) snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir);
-
+ if (!mysqld[0]) + snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir); + if (stat(mysqld, &buf))
{
snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir);
@@ -245,7 +251,7 @@ void finish_defaults() /******************************************************************************
read_defaults()
-
+ Read the defaults.
******************************************************************************/
@@ -256,64 +262,66 @@ void read_defaults(arg_list_t *pal) char mydefaults[PATH_MAX];
char line[PATH_MAX];
FILE *fp;
-
- // defaults output file
- snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir);
- remove(defaults_file);
- // mysqladmin file
+ // defaults output file + snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir); + remove(defaults_file); + + // mysqladmin file snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
-
+ // args
init_args(&al); add_arg(&al, mydefaults); - if (default_option[0]) add_arg(&al, default_option); + if (default_option[0]) + add_arg(&al, default_option); add_arg(&al, "mysqld"); add_arg(&al, "server"); add_arg(&al, "mysqld_safe"); add_arg(&al, "safe_mysqld"); - spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); + spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); free_args(&al); - // gather defaults
- if((fp = fopen(defaults_file, "r")) != NULL)
- {
- while(fgets(line, PATH_MAX, fp))
- {
+ // gather defaults + if ((fp= fopen(defaults_file, "r")) != NULL) + { + while (fgets(line, PATH_MAX, fp)) + { char *p;
-
+ // remove end-of-line character
- if ((p = strrchr(line, '\n')) != NULL) *p = '\0';
-
+ if ((p= strrchr(line, '\n')) != NULL) + *p= '\0'; + // add the option as an argument
- add_arg(pal, line);
- }
-
- fclose(fp);
- }
-
- // remove file
- remove(defaults_file);
+ add_arg(pal, line); + } + + fclose(fp); + } + + // remove file + remove(defaults_file); }
/******************************************************************************
parse_args()
-
+ Get the options.
******************************************************************************/
void parse_args(int argc, char *argv[])
{
- int index = 0;
+ int index= 0; int c;
-
+ // parse options
enum opts
{
- OPT_BASEDIR = 0xFF,
+ OPT_BASEDIR= 0xFF, OPT_DATADIR,
OPT_PID_FILE,
OPT_BIND_ADDRESS,
@@ -321,74 +329,79 @@ void parse_args(int argc, char *argv[]) OPT_ERR_LOG,
OPT_SAFE_LOG,
OPT_MYSQLD, - OPT_HELP + OPT_HELP, + OPT_SETVAR };
-
- static struct option options[] =
+ + static struct option options[]= {
- {"autoclose", no_argument, &autoclose, TRUE},
- {"basedir", required_argument, 0, OPT_BASEDIR},
- {"check-tables", no_argument, &checktables, TRUE}, - {"datadir", required_argument, 0, OPT_DATADIR},
- {"pid-file", required_argument, 0, OPT_PID_FILE},
- {"bind-address", required_argument, 0, OPT_BIND_ADDRESS},
- {"port", required_argument, 0, OPT_PORT},
- {"err-log", required_argument, 0, OPT_ERR_LOG},
- {"safe-log", required_argument, 0, OPT_SAFE_LOG},
- {"mysqld", required_argument, 0, OPT_MYSQLD},
- {"help", no_argument, 0, OPT_HELP}, - {0, 0, 0, 0}
+ {"autoclose", no_argument, &autoclose, TRUE}, + {"basedir", required_argument, 0, OPT_BASEDIR}, + {"check-tables", no_argument, &checktables, TRUE}, + {"datadir", required_argument, 0, OPT_DATADIR}, + {"pid-file", required_argument, 0, OPT_PID_FILE}, + {"bind-address", required_argument, 0, OPT_BIND_ADDRESS}, + {"port", required_argument, 0, OPT_PORT}, + {"err-log", required_argument, 0, OPT_ERR_LOG}, + {"safe-log", required_argument, 0, OPT_SAFE_LOG}, + {"mysqld", required_argument, 0, OPT_MYSQLD}, + {"help", no_argument, 0, OPT_HELP}, + {"set-variable", required_argument, 0, OPT_SETVAR}, + {0, 0, 0, 0} };
-
+ // we have to reset getopt_long because we use it multiple times
- optind = 1;
-
+ optind= 1; + // turn off error reporting
- opterr = 0;
-
- while ((c = getopt_long(argc, argv, "b:h:P:", options, &index)) >= 0)
+ opterr= 0; + + while ((c= getopt_long(argc, argv, "b:h:P:", options, &index)) >= 0) {
- switch (c)
- {
+ switch (c) { case OPT_BASEDIR:
case 'b':
strcpy(basedir, optarg);
break;
-
+ case OPT_DATADIR:
case 'h':
strcpy(datadir, optarg);
break;
-
+ case OPT_PID_FILE:
strcpy(pid_file, optarg);
break;
-
+ case OPT_BIND_ADDRESS:
strcpy(address, optarg);
break;
-
+ case OPT_PORT:
case 'P':
strcpy(port, optarg);
break;
-
+ case OPT_ERR_LOG:
strcpy(err_log, optarg);
break;
-
+ case OPT_SAFE_LOG:
strcpy(safe_log, optarg);
break;
-
+ case OPT_MYSQLD:
strcpy(mysqld, optarg);
break;
-
+ + case OPT_SETVAR: + parse_setvar(optarg); + break; + case OPT_HELP: usage(); break; - + default:
// ignore
break;
@@ -396,17 +409,37 @@ void parse_args(int argc, char *argv[]) }
}
+/* + parse_setvar(char *arg) + Pasrsing for port just to display the port num on the mysqld_safe screen +*/ +void parse_setvar(char *arg) +{ + char *pos; + + if ((pos= strindex(arg, "port"))) + { + for (; *pos && *pos != '='; pos++); + if (*pos) + strcpy(port, pos + 1); + } +} + +/****************************************************************************** + + + /******************************************************************************
get_options()
-
+ Get the options.
******************************************************************************/
void get_options(int argc, char *argv[])
{
arg_list_t al; -
+ // start defaults
start_defaults(argc, argv);
@@ -416,10 +449,10 @@ void get_options(int argc, char *argv[]) read_defaults(&al); parse_args(al.argc, al.argv); free_args(&al); -
+ // command-line arguments
parse_args(argc, argv);
-
+ // finish defaults
finish_defaults();
}
@@ -427,7 +460,7 @@ void get_options(int argc, char *argv[]) /******************************************************************************
check_data_vol()
-
+ Check the database volume.
******************************************************************************/
@@ -437,23 +470,23 @@ void check_data_vol() struct volume_info vol;
char buff[PATH_MAX];
char *p;
-
+ // clear struct
memset(&vol, 0, sizeof(vol));
-
+ // find volume name
strcpy(buff, datadir);
- if (p = strchr(buff, ':'))
+ if (p= strchr(buff, ':')) {
// terminate after volume name
- *p = 0;
+ *p= 0; }
else
{
// assume SYS volume
strcpy(buff, "SYS");
}
-
+ // retrieve information
netware_vol_info_from_name(&vol, buff);
@@ -467,25 +500,25 @@ void check_data_vol() /******************************************************************************
check_setup()
-
+ Check the current setup.
******************************************************************************/
void check_setup()
{
- struct stat info;
+ struct stat info; char temp[PATH_MAX];
-
+ // remove any current pid_file
- if (!stat(pid_file, &info) && (remove(pid_file) < 0))
- {
+ if (!stat(pid_file, &info) && (remove(pid_file) < 0)) + { log("ERROR: Unable to remove current pid file!\n\n");
exit(-1);
- }
-
- // check the data volume
+ } + + // check the data volume check_data_vol();
-
+ // check for a database
snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir);
if (stat(temp, &info))
@@ -498,7 +531,7 @@ void check_setup() /******************************************************************************
check_tables()
-
+ Check the database tables.
******************************************************************************/
@@ -506,21 +539,21 @@ void check_tables() {
arg_list_t al; char mycheck[PATH_MAX];
- char table[PATH_MAX];
- char db[PATH_MAX];
- DIR *datadir_entry, *db_entry, *table_entry;
-
- // status
+ char table[PATH_MAX]; + char db[PATH_MAX]; + DIR *datadir_entry, *db_entry, *table_entry; + + // status log("checking tables...\n");
-
+ // list databases
- if ((datadir_entry = opendir(datadir)) == NULL)
- {
- return;
- }
+ if ((datadir_entry= opendir(datadir)) == NULL) + { + return; + } - while((db_entry = readdir(datadir_entry)) != NULL)
- {
+ while ((db_entry= readdir(datadir_entry)) != NULL) + { if (db_entry->d_name[0] == '.')
{
// Skip
@@ -529,184 +562,191 @@ void check_tables() {
// create long db name
snprintf(db, PATH_MAX, "%s/%s", datadir, db_entry->d_name);
-
+ // list tables
- if ((db_entry = opendir(db)) == NULL)
+ if ((db_entry= opendir(db)) == NULL) {
- continue;
+ continue; }
-
- while((table_entry = readdir(db_entry)) != NULL)
+ + while ((table_entry= readdir(db_entry)) != NULL) {
- // create long table name
- snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name));
-
- if (strindex(table, ".myi"))
- {
- // ** myisamchk
-
- // mysqladmin file
- snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir);
-
- // args
- init_args(&al); - add_arg(&al, mycheck); - add_arg(&al, "--silent"); - add_arg(&al, "--force"); - add_arg(&al, "--fast"); - add_arg(&al, "--medium-check"); - add_arg(&al, "-O"); - add_arg(&al, "key_buffer=64M"); - add_arg(&al, "-O"); - add_arg(&al, "sort_buffer=64M"); - add_arg(&al, table); -
- spawn(mycheck, &al, TRUE, NULL, NULL, NULL); -
- free_args(&al); - }
- else if (strindex(table, ".ism"))
- {
- // ** isamchk
-
- // mysqladmin file
- snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir);
-
- // args
- init_args(&al); - add_arg(&al, mycheck); - add_arg(&al, "--silent"); - add_arg(&al, "--force"); - add_arg(&al, "-O"); - add_arg(&al, "sort_buffer=64M"); - add_arg(&al, table); -
- spawn(mycheck, &al, TRUE, NULL, NULL, NULL); -
- free_args(&al); - }
+ // create long table name + snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name)); + + if (strindex(table, ".myi")) + { + // ** myisamchk + + // mysqladmin file + snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir); +
+ // args + init_args(&al); + add_arg(&al, mycheck); + add_arg(&al, "--silent"); + add_arg(&al, "--force"); + add_arg(&al, "--fast"); + add_arg(&al, "--medium-check"); + add_arg(&al, "-O"); + add_arg(&al, "key_buffer=64M"); + add_arg(&al, "-O"); + add_arg(&al, "sort_buffer=64M"); + add_arg(&al, table); +
+ spawn(mycheck, &al, TRUE, NULL, NULL, NULL); + + free_args(&al); + } + else if (strindex(table, ".ism")) + { + // ** isamchk + + // mysqladmin file + snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir); + + // args + init_args(&al); + add_arg(&al, mycheck); + add_arg(&al, "--silent"); + add_arg(&al, "--force"); + add_arg(&al, "-O"); + add_arg(&al, "sort_buffer=64M"); + add_arg(&al, table); + + spawn(mycheck, &al, TRUE, NULL, NULL, NULL); + + free_args(&al); + } }
}
- }
+ } }
/******************************************************************************
mysql_start()
-
+ Start the mysql server.
******************************************************************************/
void mysql_start(int argc, char *argv[])
{
- arg_list_t al; - int i, j, err;
- struct stat info;
- time_t cal;
- struct tm lt;
- char stamp[PATH_MAX];
- char skip;
-
+ arg_list_t al; + int i, j, err; + struct stat info; + time_t cal; + struct tm lt; + char stamp[PATH_MAX]; + char skip; + // private options
- static char *private_options[] =
+ static char *private_options[]= {
- "--autoclose",
+ "--autoclose", "--check-tables", "--help", - "--err-log=",
- "--mysqld=",
- NULL
+ "--err-log=", + "--mysqld=", + NULL };
-
- // args
- init_args(&al); - add_arg(&al, "%s", mysqld); -
- // parent args
- for(i = 1; i < argc; i++)
- {
- skip = FALSE;
-
+ + // args + init_args(&al); + add_arg(&al, "%s", mysqld); + + // parent args + for (i= 1; i < argc; i++) + { + skip= FALSE; + // skip private arguments
- for (j=0; private_options[j]; j++)
+ for (j= 0; private_options[j]; j++) {
- if(!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
+ if (!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) {
- skip = TRUE;
- break;
+ skip= TRUE; + consoleprintf("The argument skipped is %s\n", argv[i]); + break; }
}
-
- if (!skip) add_arg(&al, "%s", argv[i]); - }
-
+ + if (!skip) + { + add_arg(&al, "%s", argv[i]); + consoleprintf("The final argument is %s\n", argv[i]); + } + } // spawn
- do
- {
- // check the database tables
- if (checktables) check_tables(); -
- // status
+ do + { + // check the database tables + if (checktables) + check_tables(); + + // status time(&cal);
localtime_r(&cal, <);
strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", <);
log("mysql started : %s\n", stamp);
-
- // spawn mysqld
- spawn(mysqld, &al, TRUE, NULL, NULL, err_log); - }
- while (!stat(pid_file, &info));
-
- // status
+ + // spawn mysqld + spawn(mysqld, &al, TRUE, NULL, NULL, err_log); + } + while (!stat(pid_file, &info)); + + // status time(&cal);
localtime_r(&cal, <);
strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", <);
log("mysql stopped : %s\n\n", stamp);
-
- // free args
- free_args(&al); + + // free args + free_args(&al); }
/******************************************************************************
main()
-
+ ******************************************************************************/
int main(int argc, char **argv)
{
- char temp[PATH_MAX];
-
+ char temp[PATH_MAX]; + // get the options
- get_options(argc, argv);
+ get_options(argc, argv); // keep the screen up
- if (!autoclose) setscreenmode(SCR_NO_MODE);
-
+ if (!autoclose) + setscreenmode(SCR_NO_MODE); + // create log file
- log_fd = fopen(safe_log, "w+");
-
+ log_fd= fopen(safe_log, "w+"); + // header
log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-
- // status
- log("address : %s\n", address);
- log("port : %s\n", port);
+ + // status + log("address : %s\n", address); + log("port : %s\n", port); log("daemon : %s\n", mysqld);
- log("base directory : %s\n", basedir);
- log("data directory : %s\n", datadir);
- log("pid file : %s\n", pid_file);
- log("error file : %s\n", err_log);
- log("log file : %s\n", safe_log);
+ log("base directory : %s\n", basedir); + log("data directory : %s\n", datadir); + log("pid file : %s\n", pid_file); + log("error file : %s\n", err_log); + log("log file : %s\n", safe_log); log("\n");
-
+ // check setup
check_setup();
-
+ // start the MySQL server
- mysql_start(argc, argv);
-
- // close log file
- if (log_fd) fclose(log_fd);
-
+ mysql_start(argc, argv); + + // close log file + if (log_fd) + fclose(log_fd); + return 0;
}
diff --git a/netware/static_init_db.sql b/netware/static_init_db.sql index 63ee623dac4..e9fb92f4a97 100644 --- a/netware/static_init_db.sql +++ b/netware/static_init_db.sql @@ -10,7 +10,7 @@ INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','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)) 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(45) 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)) comment='Users and global 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)) 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); @@ -20,7 +20,7 @@ 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)) 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(60) 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)) comment='Table privileges'; +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)) 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)) comment='Column privileges'; |