File: mysql_tzinfo_to_sql.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (47 lines) | stat: -rw-r--r-- 2,497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#------------------------------------------------------------------------------
# Test mysql_tzinfo_to_sql program against bundled zoneinfo files.
# The mysql_tzinfo_to_sql program loads the time zone tables in the mysql 
# database. It is used on systems that have a zoneinfo database (the set of 
# files describing time zones). 
# Examples of such systems are Linux, FreeBSD, Solaris, and Mac OS X. One 
# likely location for these files is the /usr/share/zoneinfo directory 
# (/usr/share/lib/zoneinfo on Solaris) This test loads zoneinfo files from 
# std_data/zoneinfo to ensure stability. 
# usage: 
# 1] mysql_tzinfo_to_sql tz_dir
# 2] mysql_tzinfo_to_sql tz_file tz_name
# 3] mysql_tzinfo_to_sql --leap tz_file
# Test aims loading zone tables in the mysql with above command.
# Data is loaded into zone table from test_zone database instead of mysql 
# database.
#------------------------------------------------------------------------------
--source include/not_windows.inc

# Create tables zone tables in test_zone database
CREATE DATABASE test_zone;
USE test_zone;
CREATE TABLE time_zone as SELECT * FROM mysql.time_zone WHERE 1 = 0;
CREATE TABLE time_zone_leap_second as SELECT * FROM mysql.time_zone_leap_second WHERE 1 = 0;
CREATE TABLE time_zone_name as SELECT * FROM mysql.time_zone_name WHERE 1 = 0;
CREATE TABLE time_zone_transition as SELECT * FROM mysql.time_zone_transition WHERE 1 = 0;
CREATE TABLE time_zone_transition_type as SELECT * FROM mysql.time_zone_transition_type WHERE 1 = 0;

--echo # Load zone table for Japanese zones. (mysql_tzinfo_to_sql std_data/Japan test_japan).
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/std_data/Japan test_japan >$MYSQLTEST_VARDIR/tmp/loadzonefile.sql
--source $MYSQLTEST_VARDIR/tmp/loadzonefile.sql

--echo # Load Moscow zone table with --leap option. (mysql_tzinfo_to_sql --leap std_data/Moscow_leap)
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/std_data/Moscow_leap >$MYSQLTEST_VARDIR/tmp/loadzonefile.sql
--source $MYSQLTEST_VARDIR/tmp/loadzonefile.sql

--echo # Load zone table files in Europe folder. (mysql_tzinfo_to_sql std_data/Europe)
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/std_data/Europe >$MYSQLTEST_VARDIR/tmp/loadzonefile.sql
--source $MYSQLTEST_VARDIR/tmp/loadzonefile.sql

# Load timezone info file with garbage content
--error 1
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/std_data/Factory test_junk_content

# Cleanup
DROP DATABASE test_zone;
--remove_file $MYSQLTEST_VARDIR/tmp/loadzonefile.sql