Modified:
branches/5.2/CHANGES
branches/5.2/Driver/Source/Types/MySqlBinary.cs
branches/5.2/TestSuite/Source/DataTypeTests.cs
Log:
Fixed guid type so that a null value is still returned as guid type (bug #35041)
Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES 2008-03-01 00:09:59 UTC (rev 1203)
+++ branches/5.2/CHANGES 2008-03-04 17:25:06 UTC (rev 1204)
@@ -7,6 +7,7 @@
using stored procedures because of our change to using @ instead of ? (bug #34941)
- Fixed problem in datagrid code related to creating a new table. This problem may
have been introduced with .NET 2.0 SP1.
+- Fixed guid type so that a null value is still returned as guid type (bug #35041)
Version 5.2.1 - 2/27/2008
- Tons of fixes in providers. The actually work now. :)
Modified: branches/5.2/Driver/Source/Types/MySqlBinary.cs
===================================================================
--- branches/5.2/Driver/Source/Types/MySqlBinary.cs 2008-03-01 00:09:59 UTC (rev 1203)
+++ branches/5.2/Driver/Source/Types/MySqlBinary.cs 2008-03-04 17:25:06 UTC (rev 1204)
@@ -169,15 +169,18 @@
IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
{
- if (nullVal)
- return new MySqlBinary(type, true);
+ MySqlBinary b;
+ if (nullVal)
+ b = new MySqlBinary(type, true);
+ else
+ {
+ if (length == -1)
+ length = (long)stream.ReadFieldLength();
- if (length == -1)
- length = (long)stream.ReadFieldLength();
-
- byte[] newBuff = new byte[length];
- stream.Read(newBuff, 0, (int)length);
- MySqlBinary b = new MySqlBinary(type, newBuff);
+ byte[] newBuff = new byte[length];
+ stream.Read(newBuff, 0, (int)length);
+ b = new MySqlBinary(type, newBuff);
+ }
b.IsGuid = this.IsGuid;
return b;
}
Modified: branches/5.2/TestSuite/Source/DataTypeTests.cs
===================================================================
--- branches/5.2/TestSuite/Source/DataTypeTests.cs 2008-03-01 00:09:59 UTC (rev 1203)
+++ branches/5.2/TestSuite/Source/DataTypeTests.cs 2008-03-04 17:25:06 UTC (rev 1204)
@@ -869,5 +869,27 @@
Assert.AreEqual(g, dt.Rows[0][1]);
}
+
+ /// <summary>
+ /// Bug #35041 'Binary(16) as GUID' - columns lose IsGuid value after a NULL
value found
+ /// </summary>
+ [Test]
+ public void Binary16AsGuidWithNull()
+ {
+ execSQL("DROP TABLE IF EXISTS Test");
+ execSQL(@"CREATE TABLE Test (id int(10) NOT NULL AUTO_INCREMENT,
+ AGUID binary(16), PRIMARY KEY (id))");
+ Guid g = new Guid();
+ byte[] guid = g.ToByteArray();
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (NULL, @g)",
conn);
+ cmd.Parameters.AddWithValue("@g", guid);
+ cmd.ExecuteNonQuery();
+ execSQL("insert into Test (AGUID) values (NULL)");
+ cmd.ExecuteNonQuery();
+
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
+ DataTable dt = new DataTable();
+ da.Fill(dt);
+ }
}
}
| Thread |
|---|
| • Connector/NET commit: r1204 - in branches/5.2: . Driver/Source/Types TestSuite/Source | rburnett | 4 Mar |