Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing time difference for non daylight saving period in getdate test file. #3074

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions test/JDBC/expected/getdate-vu-prepare.out
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ CREATE PROCEDURE dbo.GetSysDatetimeDiff
AS
BEGIN
DECLARE @x datetime2 = SYSDATETIME();
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
DECLARE @y datetime2 = SYSDATETIME()
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
Expand All @@ -157,11 +157,11 @@ CREATE PROCEDURE dbo.GetSysDatetimeOffsetDiff
AS
BEGIN
DECLARE @x datetime2 = sysdatetimeoffset();
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
DECLARE @y datetime2 = sysdatetimeoffset()
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
Expand All @@ -172,11 +172,11 @@ CREATE PROCEDURE dbo.GetDateDiff
AS
BEGIN
DECLARE @x datetime2 = getdate();
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
DECLARE @y datetime2 = getdate()
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
Expand All @@ -187,11 +187,11 @@ CREATE PROCEDURE dbo.GetCurrTimestampDiff
AS
BEGIN
DECLARE @x datetime2 = CURRENT_TIMESTAMP;
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
DECLARE @y datetime2 = CURRENT_TIMESTAMP
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
Expand All @@ -216,14 +216,14 @@ GO
DECLARE @sysdatetime1 datetime2, @sysdatetimeoffset1 datetime2, @getdate1 datetime2, @currtimestamp1 datetime2;
DECLARE @sysdatetime2 datetime2, @sysdatetimeoffset2 datetime2, @getdate2 datetime2, @currtimestamp2 datetime2;
SELECT @sysdatetime1 = SYSDATETIME(), @sysdatetimeoffset1 = sysdatetimeoffset(), @getdate1 = getdate(), @currtimestamp1 = CURRENT_TIMESTAMP;
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
SELECT @sysdatetime2 = SYSDATETIME(), @sysdatetimeoffset2 = sysdatetimeoffset(), @getdate2 = getdate(), @currtimestamp2 = CURRENT_TIMESTAMP;
select set_config('timezone', 'UTC', false);
INSERT INTO datetimediffTable values (dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetime2, @sysdatetime1), 420, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetimeoffset2, @sysdatetimeoffset1), 420, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @getdate2, @getdate1), 420, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @currtimestamp2, @currtimestamp1), 420, -1))
INSERT INTO datetimediffTable values (dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetime2, @sysdatetime1), -330, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetimeoffset2, @sysdatetimeoffset1), -330, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @getdate2, @getdate1), -330, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @currtimestamp2, @currtimestamp1), -330, -1))
GO
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand Down Expand Up @@ -276,6 +276,7 @@ GO
CREATE TABLE trgdatetimediffTestTab(sysdatetime int, sysdatetimeoffset int, getdate int, currtimestamp int)
GO

-- For daylight saving period DIFF will be 420, For non daylight saving period DIFF will be
CREATE TRIGGER trgdatetimediff
ON datetimediffTable
AFTER INSERT
Expand All @@ -284,9 +285,9 @@ BEGIN
DECLARE @sysdatetime1 datetime2, @sysdatetimeoffset1 datetime2, @getdate1 datetime2, @currtimestamp1 datetime2;
DECLARE @sysdatetime2 datetime2, @sysdatetimeoffset2 datetime2, @getdate2 datetime2, @currtimestamp2 datetime2;
SELECT @sysdatetime1 = SYSDATETIME(), @sysdatetimeoffset1 = sysdatetimeoffset(), @getdate1 = getdate(), @currtimestamp1 = CURRENT_TIMESTAMP;
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
SELECT @sysdatetime2 = SYSDATETIME(), @sysdatetimeoffset2 = sysdatetimeoffset(), @getdate2 = getdate(), @currtimestamp2 = CURRENT_TIMESTAMP;
select set_config('timezone', 'UTC', false);
INSERT INTO trgdatetimediffTestTab values (dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetime2, @sysdatetime1), 420, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetimeoffset2, @sysdatetimeoffset1), 420, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @getdate2, @getdate1), 420, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @currtimestamp2, @currtimestamp1), 420, -1))
INSERT INTO trgdatetimediffTestTab values (dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetime2, @sysdatetime1), -330, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @sysdatetimeoffset2, @sysdatetimeoffset1), -330, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @getdate2, @getdate1), -330, -1), dbo.checkDatetimeDiff(DATEDIFF(MINUTE, @currtimestamp2, @currtimestamp1), -330, -1))
END;
GO
68 changes: 34 additions & 34 deletions test/JDBC/expected/getdate-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ int

-- all the tests have datetime difference spillover correction to avoid flakiness.
declare @x datetime2 = sysdatetime()
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
declare @y datetime2 = sysdatetime()
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -106,18 +106,18 @@ int


declare @x datetime2 = sysdatetimeoffset()
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
declare @y datetime2 = sysdatetimeoffset()
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -132,18 +132,18 @@ int


declare @x datetime2 = getdate()
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
declare @y datetime2 = getdate()
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -158,18 +158,18 @@ int


declare @x datetime2 = CURRENT_TIMESTAMP
select set_config('timezone', 'US/Pacific', false);
select set_config('timezone', 'Asia/Kolkata', false);
declare @y datetime2 = CURRENT_TIMESTAMP
select set_config('timezone', 'UTC', false);
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 420 or @diff = 419
IF @diff = -330 or @diff = -331
SELECT 1;
ELSE
SELECT 0;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -183,7 +183,7 @@ int
~~END~~


declare @x datetime2 = sysdatetime() AT TIME ZONE 'Pacific Standard Time'
declare @x datetime2 = sysdatetime() AT TIME ZONE 'India Standard Time'
declare @y datetime2 = sysdatetime() AT TIME ZONE 'UTC'
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 0 or @diff = -1
Expand All @@ -197,10 +197,10 @@ int
~~END~~


declare @x datetime2 = sysdatetimeoffset() AT TIME ZONE 'Pacific Standard Time'
declare @x datetime2 = sysdatetimeoffset() AT TIME ZONE 'India Standard Time'
declare @y datetime2 = sysdatetimeoffset() AT TIME ZONE 'UTC'
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = -420 or @diff = -421
IF @diff = 330 or @diff = 329
SELECT 1;
ELSE
SELECT 0;
Expand All @@ -211,7 +211,7 @@ int
~~END~~


declare @x datetime2 = getdate() AT TIME ZONE 'Pacific Standard Time'
declare @x datetime2 = getdate() AT TIME ZONE 'India Standard Time'
declare @y datetime2 = getdate() AT TIME ZONE 'UTC'
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 0 or @diff = -1
Expand All @@ -225,7 +225,7 @@ int
~~END~~


declare @x datetime2 = CURRENT_TIMESTAMP AT TIME ZONE 'Pacific Standard Time'
declare @x datetime2 = CURRENT_TIMESTAMP AT TIME ZONE 'India Standard Time'
declare @y datetime2 = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
DECLARE @diff int = DATEDIFF(MINUTE, @y, @x);
IF @diff = 0 or @diff = -1
Expand All @@ -243,7 +243,7 @@ EXEC dbo.GetSysDatetimeDiff;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -261,7 +261,7 @@ EXEC dbo.GetSysDatetimeOffsetDiff;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -279,7 +279,7 @@ EXEC dbo.GetDateDiff;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -297,7 +297,7 @@ EXEC dbo.GetCurrTimestampDiff;
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -320,13 +320,13 @@ int#!#int#!#int#!#int


declare @x datetime2 = SYSDATETIME();
select set_config('timezone', 'US/Pacific', false);
select dbo.GetSysDatetimeDiffFunc(@x, -420, 1)
select set_config('timezone', 'Asia/Kolkata', false);
select dbo.GetSysDatetimeDiffFunc(@x, 330, 1)
select set_config('timezone', 'UTC', false);
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -341,13 +341,13 @@ UTC


declare @x datetime2 = sysdatetimeoffset();
select set_config('timezone', 'US/Pacific', false);
select dbo.GetSysDatetimeOffsetDiffFunc(@x, -420, 1)
select set_config('timezone', 'Asia/Kolkata', false);
select dbo.GetSysDatetimeOffsetDiffFunc(@x, 330, 1)
select set_config('timezone', 'UTC', false);
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -362,13 +362,13 @@ UTC


declare @x datetime2 = getdate();
select set_config('timezone', 'US/Pacific', false);
select dbo.GetDateDiffFunc(@x, -420, 1)
select set_config('timezone', 'Asia/Kolkata', false);
select dbo.GetDateDiffFunc(@x, 330, 1)
select set_config('timezone', 'UTC', false);
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -383,13 +383,13 @@ UTC


declare @x datetime2 = CURRENT_TIMESTAMP;
select set_config('timezone', 'US/Pacific', false);
select dbo.GetCurrTimestampDiffFunc(@x, -420, 1)
select set_config('timezone', 'Asia/Kolkata', false);
select dbo.GetCurrTimestampDiffFunc(@x, 330, 1)
select set_config('timezone', 'UTC', false);
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand All @@ -407,7 +407,7 @@ INSERT INTO datetimediffTable values (0, 0, 0, 0)
go
~~START~~
text
US/Pacific
Asia/Kolkata
~~END~~

~~START~~
Expand Down
Loading
Loading