DataAction / AdoNetCore.AseClient

AdoNetCore.AseClient - a .NET Core DB Provider for SAP ASE
Apache License 2.0
106 stars 44 forks source link

[linq2db] Time value returned as DateTime with different date in native and managed providers #58

Closed MaceWindu closed 6 years ago

MaceWindu commented 6 years ago

query:

SELECT
    Convert(Time, Convert(VarChar(11), DatePart(Hour, [t1].[DateTimeValue])) + ':01:01') as [c1]
FROM
    [LinqDataTypes] [t1]

column definition:

DateTimeValue  datetime      NULL,

native provider returns time as DateTime with 1/1/0001 date part

linq2db test: ConvertTests.ToSqlTime

senseibaka commented 6 years ago

When I run this test case against the reference driver, I'm getting different results than you:

SELECT
  Convert(Time, Convert(VarChar(11), DatePart(Hour, [t1].[DateTimeValue])) + ':01:01') as [c1]
FROM
  DateTimeTest [t1]

Results in 1900-01-01 for the date component.

SELECT Convert(time, Convert(VarChar(11), DatePart(Hour, getdate())) + ':01:01')

Results in 1900-01-01 for the date component


One extra item, in the case of converting to bigtime:

SELECT Convert(bigtime, Convert(VarChar(11), DatePart(Hour, getdate())) + ':01:01')

Results in 0001-01-01 for the date component.

However, our driver doesn't support for bigtime (yet)

MaceWindu commented 6 years ago

My bad, found bug in our test :)