Modified:
branches/5.1/CHANGES
branches/5.1/Driver/Source/Types/MySqlDateTime.cs
branches/5.1/TestSuite/Source/DateTimeTests.cs
Log:
- fixed problem with datetime formatting that causes an extra space to be included
between the date and time when sent to the server (bug #41021)
Modified: branches/5.1/CHANGES
===================================================================
--- branches/5.1/CHANGES 2008-11-26 00:13:41 UTC (rev 1466)
+++ branches/5.1/CHANGES 2008-12-03 17:29:44 UTC (rev 1467)
@@ -7,6 +7,8 @@
timed out and was cancelled. (bug #40091)
- fixed problem where using respect binary flags would not use the connection char set
and therefore return strings with a bad encoding.
+ - fixed problem with datetime formatting that causes an extra space to be included
between the
+ date and time when sent to the server (bug #41021)
Version 5.1.7 - 8/20/08
- Fixed problem with DDEX provider that could sometimes prevent table altering when
working with
Modified: branches/5.1/Driver/Source/Types/MySqlDateTime.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlDateTime.cs 2008-11-26 00:13:41 UTC (rev 1466)
+++ branches/5.1/Driver/Source/Types/MySqlDateTime.cs 2008-12-03 17:29:44 UTC (rev 1467)
@@ -256,7 +256,7 @@
val = String.Format("{0:0000}-{1:00}-{2:00}",
value.Year, value.Month, value.Day);
if (type != MySqlDbType.Date)
- val = String.Format("{0} {1:00}:{2:00}:{3:00}", val,
+ val = String.Format("{0} {1:00}:{2:00}:{3:00}", val,
value.Hour, value.Minute, value.Second);
}
stream.WriteStringNoNull("'" + val + "'");
Modified: branches/5.1/TestSuite/Source/DateTimeTests.cs
===================================================================
--- branches/5.1/TestSuite/Source/DateTimeTests.cs 2008-11-26 00:13:41 UTC (rev 1466)
+++ branches/5.1/TestSuite/Source/DateTimeTests.cs 2008-12-03 17:29:44 UTC (rev 1467)
@@ -482,6 +482,26 @@
MySqlDateTime mdt = new MySqlDateTime(dt);
Assert.AreEqual(dt.ToString(), mdt.ToString());
}
+
+ /// <summary>
+ /// Bug #41021 DateTime format incorrect
+ /// </summary>
+ [Test]
+ public void DateFormat()
+ {
+ DateTime dt = DateTime.Now;
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES(1, ?dt, NULL,
NULL, NULL)", conn);
+ cmd.Parameters.Add("?dt", dt);
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = "SELECT dt FROM Test WHERE DATE_FORMAT(DATE(dt),
GET_FORMAT(DATETIME, 'ISO'))=?datefilter";
+ cmd.Parameters.Clear();
+ cmd.Parameters.Add("?datefilter", dt.Date);
+ using (MySqlDataReader reader = cmd.ExecuteReader())
+ {
+ Assert.IsTrue(reader.Read());
+ }
+ }
}
}
| Thread |
|---|
| • Connector/NET commit: r1467 - in branches/5.1: . Driver/Source/Types TestSuite/Source | rburnett | 3 Dec |