Skip to content

Commit bb39cd8

Browse files
committed
Add test for a new Connector/NET bug.
1 parent 7ad6182 commit bb39cd8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

docs/content/tutorials/migrating-from-connector-net.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,4 @@ The following bugs in Connector/NET are fixed by switching to MySqlConnector. (~
248248
* [#98322](https://bugs.mysql.com/bug.php?id=98322): `new MySqlConnection(null)` throws `NullReferenceException`
249249
* [#99091](https://bugs.mysql.com/bug.php?id=99091): Unexpected return value getting integer for `TINYINT(1)` column
250250
* [#99793](https://bugs.mysql.com/bug.php?id=99793): Prepared stored procedure command doesn't verify parameter types
251+
* [#100159](https://bugs.mysql.com/bug.php?id=100159): SQL with DateTime parameter returns String value

tests/SideBySide/QueryTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,24 @@ public void GetIntForTinyInt1(bool treatTinyAsBoolean, bool prepare)
12541254
Assert.False(reader.Read());
12551255
}
12561256

1257+
#if !NETCOREAPP1_1_2
1258+
[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=100159")]
1259+
public void QueryDateTimeLiteral()
1260+
{
1261+
using var connection = new MySqlConnection(AppConfig.ConnectionString);
1262+
connection.Open();
1263+
1264+
string sql = "SELECT ?p0 as datevalue";
1265+
using var command = new MySqlCommand(sql, connection);
1266+
command.Parameters.AddWithValue("?p0", DateTime.UtcNow);
1267+
1268+
using var reader = command.ExecuteReader();
1269+
using var schema = reader.GetSchemaTable();
1270+
var providerType = (MySqlDbType) (int) schema.Rows[0]["ProviderType"];
1271+
Assert.Equal(MySqlDbType.DateTime, providerType);
1272+
}
1273+
#endif
1274+
12571275
class BoolTest
12581276
{
12591277
public int Id { get; set; }

0 commit comments

Comments
 (0)