Skip to content

Commit

Permalink
MariaRocks port: make datetime-aware tests work in any timezone
Browse files Browse the repository at this point in the history
This fixes
- rocksdb.col_opt_not_null
- rocksdb.col_opt_null
- rocksdb.type_date_time
  • Loading branch information
spetrunia committed Dec 3, 2016
1 parent 00e3869 commit 4f90605
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,11 @@ DROP TABLE t1;
########################
# date and time columns
########################
set @col_opt_not_nullsave_time_zone=@@time_zone;
set time_zone='UTC';
DROP TABLE IF EXISTS t1;
set @save_time_zone=@@time_zone;
set time_zone='UTC';
CREATE TABLE t1 (
d DATE NOT NULL,
dt DATETIME NOT NULL,
Expand Down Expand Up @@ -964,6 +968,7 @@ d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
set time_zone=@save_time_zone;
DROP TABLE t1;
SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12');
DROP TABLE IF EXISTS t1;
Expand Down Expand Up @@ -1201,6 +1206,7 @@ pk HEX(c)
1 C
2 C
DROP TABLE t1;
set time_zone= @col_opt_not_nullsave_time_zone;
########################
# ENUM columns
########################
Expand Down
6 changes: 6 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,11 @@ DROP TABLE t1;
########################
# date and time columns
########################
set @col_opt_nullsave_time_zone=@@time_zone;
set time_zone='UTC';
DROP TABLE IF EXISTS t1;
set @save_time_zone=@@time_zone;
set time_zone='UTC';
CREATE TABLE t1 (
d DATE NULL,
dt DATETIME NULL,
Expand Down Expand Up @@ -854,6 +858,7 @@ d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
set time_zone=@save_time_zone;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
Expand Down Expand Up @@ -1021,6 +1026,7 @@ pk HEX(c2)
2 C
3 C
DROP TABLE t1;
set time_zone=@col_opt_nullsave_time_zone;
########################
# ENUM columns
########################
Expand Down
3 changes: 3 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/r/type_date_time.result
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
DROP TABLE IF EXISTS t1;
set @save_time_zone=@@time_zone;
set time_zone='UTC';
CREATE TABLE t1 (
d DATE ,
dt DATETIME ,
Expand Down Expand Up @@ -50,4 +52,5 @@ d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
set time_zone=@save_time_zone;
DROP TABLE t1;
5 changes: 5 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ let $extra_col_opts = NOT NULL;
--echo # date and time columns
--echo ########################

set @col_opt_not_nullsave_time_zone=@@time_zone;
set time_zone='UTC';

--source type_date_time.inc

SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12');
Expand Down Expand Up @@ -123,6 +126,8 @@ SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12');
--let $col_default = '12'
--source col_not_null.inc

set time_zone= @col_opt_not_nullsave_time_zone;

--echo ########################
--echo # ENUM columns
--echo ########################
Expand Down
4 changes: 4 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ let $extra_col_opts = NULL;
--echo # date and time columns
--echo ########################

set @col_opt_nullsave_time_zone=@@time_zone;
set time_zone='UTC';

--source type_date_time.inc

--let $col_type = DATE
Expand All @@ -114,6 +117,7 @@ let $extra_col_opts = NULL;
--let $col_default = '12'
--source col_null.inc

set time_zone=@col_opt_nullsave_time_zone;

--echo ########################
--echo # ENUM columns
Expand Down
4 changes: 3 additions & 1 deletion storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

set @save_time_zone=@@time_zone;
set time_zone='UTC';
eval CREATE TABLE t1 (
d DATE $extra_col_opts,
dt DATETIME $extra_col_opts,
Expand Down Expand Up @@ -39,6 +40,7 @@ INSERT INTO t1 (d,dt,ts,t,y,y4,y2,pk) VALUES
('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1','2012-12-12 12:12:16');

SELECT d,dt,ts,t,y,y4,y2 FROM t1;
set time_zone=@save_time_zone;

DROP TABLE t1;

Expand Down

0 comments on commit 4f90605

Please sign in to comment.