From: Date: September 8 2008 8:33pm
Subject: Connector/NET commit: r1407 - in branches/5.2: . MySql.Data/Provider/Source/Types MySql.Data/Tests/Source
List-Archive: http://lists.mysql.com/commits/53539
X-Bug: 39294
Message-Id: <200809081833.m88IX5o4020373@bk-internal.mysql.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Modified:
branches/5.2/CHANGES
branches/5.2/MySql.Data/Provider/Source/Types/MySqlTime.cs
branches/5.2/MySql.Data/Tests/Source/PreparedStatements.cs
Log:
- fixed problem where negative time values with a zero hour would return as postive
values (bug #39294)
Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES 2008-09-05 20:09:35 UTC (rev 1406)
+++ branches/5.2/CHANGES 2008-09-08 18:33:05 UTC (rev 1407)
@@ -7,6 +7,8 @@
- fixed time data type so that negative values are handled properly (bug #39275)
- added runtime check for the mono platform to our Membership provider. The mono runtime
as of 1.9.1 did not support the methods needed for hashed passwords (bug #38895)
+- fixed problem where negative time values with a zero hour would return as postive
+ values (bug #39294)
Version 5.2.3 - 8/14/08
- Increased the speed of MySqlDataReader.GetOrdinal dramatically by using a couple
Modified: branches/5.2/MySql.Data/Provider/Source/Types/MySqlTime.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/Types/MySqlTime.cs 2008-09-05 20:09:35 UTC (rev 1406)
+++ branches/5.2/MySql.Data/Provider/Source/Types/MySqlTime.cs 2008-09-08 18:33:05 UTC (rev 1407)
@@ -193,7 +193,7 @@
int hours = Int32.Parse(parts[0]);
int mins = Int32.Parse(parts[1]);
int secs = Int32.Parse(parts[2]);
- if (hours < 0)
+ if (hours < 0 || parts[0].StartsWith("-"))
{
mins *= -1;
secs *= -1;
Modified: branches/5.2/MySql.Data/Tests/Source/PreparedStatements.cs
===================================================================
--- branches/5.2/MySql.Data/Tests/Source/PreparedStatements.cs 2008-09-05 20:09:35 UTC (rev 1406)
+++ branches/5.2/MySql.Data/Tests/Source/PreparedStatements.cs 2008-09-08 18:33:05 UTC (rev 1407)
@@ -821,20 +821,24 @@
///
/// Bug #39275 Inserting negative time value through the use of MySqlParameter throws exception
+ /// Bug #39294 Reading negative time value greater than -01:00:00 return positive value
///
[Test]
public void NegativeTimePrepared()
{
NegativeTime(true);
+ ReadNegativeTime(true);
}
///
/// Bug #39275 Inserting negative time value through the use of MySqlParameter throws exception
+ /// Bug #39294 Reading negative time value greater than -01:00:00 return positive value
///
[Test]
public void NegativeTimeNonPrepared()
{
NegativeTime(false);
+ ReadNegativeTime(false);
}
[Test]
@@ -872,6 +876,25 @@
Assert.AreEqual(t3, t);
}
}
+
+ private void ReadNegativeTime(bool prepared)
+ {
+ execSQL("DROP TABLE IF EXISTS Test");
+ execSQL("CREATE TABLE Test(id int, t time)");
+ execSQL("INSERT INTO Test VALUES (1, '-00:10:00')");
+
+ MySqlCommand cmd = new MySqlCommand("SELECT * FROM Test", conn);
+ if (prepared)
+ cmd.Prepare();
+ using (MySqlDataReader reader = cmd.ExecuteReader())
+ {
+ reader.Read();
+ TimeSpan ts = reader.GetTimeSpan(1);
+ Assert.AreEqual(0, ts.Hours);
+ Assert.AreEqual(-10, ts.Minutes);
+ Assert.AreEqual(0, ts.Seconds);
+ }
+ }
}
#region Configs