@@ -775,11 +775,14 @@ public void QueryTime(string column, string dataTypeName, object[] expected)
775
775
[ InlineData ( "`Year`" , "YEAR" , new object [ ] { null , 1901 , 2155 , 0 , 2016 } ) ]
776
776
public void QueryYear ( string column , string dataTypeName , object [ ] expected )
777
777
{
778
+ Func < MySqlDataReader , object > getValue = reader => reader . GetInt32 ( 0 ) ;
778
779
#if BASELINE
779
- // mysql-connector-net incorrectly returns "INT" for "YEAR"
780
- dataTypeName = "INT" ;
780
+ // Connector/NET incorrectly returns "SMALLINT" for "YEAR", and returns all YEAR values as short values
781
+ dataTypeName = "SMALLINT" ;
782
+ expected = expected . Select ( x => x is null ? null : ( object ) ( short ) ( int ) x ) . ToArray ( ) ;
783
+ getValue = reader => reader . GetInt16 ( 0 ) ;
781
784
#endif
782
- DoQuery ( "times" , column , dataTypeName , expected , reader => reader . GetInt32 ( 0 ) ) ;
785
+ DoQuery ( "times" , column , dataTypeName , expected , getValue ) ;
783
786
}
784
787
785
788
[ Theory ]
@@ -1062,7 +1065,11 @@ private static object CreateGeometry(byte[] data)
1062
1065
[ InlineData ( "DateTime" , "datatypes_times" , MySqlDbType . DateTime , 26 , typeof ( DateTime ) , "N" , 0 , 6 ) ]
1063
1066
[ InlineData ( "Timestamp" , "datatypes_times" , MySqlDbType . Timestamp , 26 , typeof ( DateTime ) , "N" , 0 , 6 ) ]
1064
1067
[ InlineData ( "Time" , "datatypes_times" , MySqlDbType . Time , 17 , typeof ( TimeSpan ) , "N" , 0 , 6 ) ]
1068
+ #if BASELINE
1069
+ [ InlineData ( "Year" , "datatypes_times" , MySqlDbType . Year , 4 , typeof ( short ) , "N" , 0 , 0 ) ]
1070
+ #else
1065
1071
[ InlineData ( "Year" , "datatypes_times" , MySqlDbType . Year , 4 , typeof ( int ) , "N" , 0 , 0 ) ]
1072
+ #endif
1066
1073
[ InlineData ( "Geometry" , "datatypes_geometry" , MySqlDbType . Geometry , int . MaxValue , typeof ( byte [ ] ) , "LN" , 0 , 0 ) ]
1067
1074
public void GetSchemaTable ( string column , string table , MySqlDbType mySqlDbType , int columnSize , Type dataType , string flags , int precision , int scale ) =>
1068
1075
DoGetSchemaTable ( column , table , mySqlDbType , columnSize , dataType , flags , precision , scale ) ;
@@ -1318,7 +1325,11 @@ public void GetColumnSchema(string column, string table, MySqlDbType mySqlDbType
1318
1325
[ InlineData ( "DateTime" , "datatypes_times" , MySqlDbType . DateTime , "DATETIME" , typeof ( DateTime ) , 2 , null ) ]
1319
1326
[ InlineData ( "Timestamp" , "datatypes_times" , MySqlDbType . Timestamp , "TIMESTAMP" , typeof ( DateTime ) , 2 , null ) ]
1320
1327
[ InlineData ( "Time" , "datatypes_times" , MySqlDbType . Time , "TIME" , typeof ( TimeSpan ) , 2 , null ) ]
1328
+ #if BASELINE
1329
+ [ InlineData ( "Year" , "datatypes_times" , MySqlDbType . Year , "YEAR" , typeof ( short ) , 2 , ( short ) 1901 ) ]
1330
+ #else
1321
1331
[ InlineData ( "Year" , "datatypes_times" , MySqlDbType . Year , "YEAR" , typeof ( int ) , 2 , 1901 ) ]
1332
+ #endif
1322
1333
#if ! BASELINE
1323
1334
[ InlineData ( "value" , "datatypes_json_core" , MySqlDbType . JSON , "JSON" , typeof ( string ) , 4 , "[]" ) ]
1324
1335
[ InlineData ( "Geometry" , "datatypes_geometry" , MySqlDbType . Geometry , "GEOMETRY" , typeof ( byte [ ] ) , 2 , null ) ]
0 commit comments