Modified:
branches/5.1/CHANGES
branches/5.1/Driver/MySql.Data.CF.csproj
branches/5.1/Driver/Source/MySqlConnectionStringBuilder.cs
branches/5.1/Driver/Source/Types/MySqlByte.cs
branches/5.1/Driver/Source/Types/MySqlUByte.cs
branches/5.1/TestSuite/Source/ConnectionStringBuilder.cs
branches/5.1/TestSuite/Source/PreparedStatements.cs
Log:
merged
Modified: branches/5.1/CHANGES
===================================================================
--- branches/5.1/CHANGES 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/CHANGES 2008-07-11 22:04:56 UTC (rev 1337)
@@ -146,6 +146,12 @@
a non-existant pool. (bug #36432)
- Fixed problem where supplying the connection reset config option can cause login to fail
when there is room to make a new connection and the pool has no idle connections.
+ - Fixed MySqlConnectionStringBuilder to first remove old keyword settings when setting
+ a value that was previously set (bug #37955)
+ - Fixed problem where executing a command that results in a fatal exception would not
+ close the connection. (bug #37991)
+ - Fixed problem with byte and unsigned byte values writing more too many bytes when
+ using prepared statements (bug #37968)
Version 5.0.9 - 4/14/08
Modified: branches/5.1/Driver/MySql.Data.CF.csproj
===================================================================
--- branches/5.1/Driver/MySql.Data.CF.csproj 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/Driver/MySql.Data.CF.csproj 2008-07-11 22:04:56 UTC (rev 1337)
@@ -61,8 +61,10 @@
<Compile Include="Source\cf\WinCE.cs" />
<Compile Include="Source\CharSetMap.cs" />
<Compile Include="Source\command.cs">
+ <SubType>Component</SubType>
</Compile>
<Compile Include="Source\CommandBuilder.cs">
+ <SubType>Component</SubType>
</Compile>
<Compile Include="Source\common\Cache.cs" />
<Compile Include="Source\common\ContextString.cs" />
Modified: branches/5.1/Driver/Source/MySqlConnectionStringBuilder.cs
===================================================================
--- branches/5.1/Driver/Source/MySqlConnectionStringBuilder.cs 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/Driver/Source/MySqlConnectionStringBuilder.cs 2008-07-11 22:04:56 UTC (rev 1337)
@@ -1178,11 +1178,18 @@
{
if (value == null)
throw new ArgumentException(Resources.KeywordNoNull, keyword);
+ object out_obj;
+ TryGetValue(keyword, out out_obj);
+
Keyword kw = GetKey(keyword);
SetValue(kw, value);
base[keyword] = value;
if (kw != Keyword.Password)
- persistConnString.AppendFormat(CultureInfo.InvariantCulture, "{0}={1};", keyword, value);
+ {
+ /* Nothing bad happens if the substring is not found */
+ persistConnString.Replace(keyword + "=" + out_obj + ";", "");
+ persistConnString.AppendFormat("{0}={1};", keyword, value);
+ }
}
private void SetValue(Keyword kw, object value)
Modified: branches/5.1/Driver/Source/Types/MySqlByte.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlByte.cs 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/Driver/Source/Types/MySqlByte.cs 2008-07-11 22:04:56 UTC (rev 1337)
@@ -101,11 +101,14 @@
void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
{
sbyte v = ((IConvertible)val).ToSByte(null);
- if (binary)
- stream.Write(BitConverter.GetBytes(v));
- else
- stream.WriteStringNoNull(v.ToString());
- }
+ if (binary)
+ {
+ byte[] b = BitConverter.GetBytes(v);
+ stream.WriteByte(b[0]);
+ }
+ else
+ stream.WriteStringNoNull(v.ToString());
+ }
IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
{
Modified: branches/5.1/Driver/Source/Types/MySqlUByte.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlUByte.cs 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/Driver/Source/Types/MySqlUByte.cs 2008-07-11 22:04:56 UTC (rev 1337)
@@ -81,11 +81,14 @@
void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
{
byte v = ((IConvertible)val).ToByte(null);
- if (binary)
- stream.Write(BitConverter.GetBytes(v));
- else
- stream.WriteStringNoNull(v.ToString());
- }
+ if (binary)
+ {
+ byte[] b = BitConverter.GetBytes(v);
+ stream.WriteByte(b[0]);
+ }
+ else
+ stream.WriteStringNoNull(v.ToString());
+ }
IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
{
Modified: branches/5.1/TestSuite/Source/ConnectionStringBuilder.cs
===================================================================
--- branches/5.1/TestSuite/Source/ConnectionStringBuilder.cs 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/TestSuite/Source/ConnectionStringBuilder.cs 2008-07-11 22:04:56 UTC (rev 1337)
@@ -93,5 +93,17 @@
Assert.IsFalse(sb.UsePerformanceMonitor);
Assert.AreEqual(25, sb.ProcedureCacheSize);
}
+
+ /// <summary>
+ /// Bug #37955 Connector/NET keeps adding the same option to the connection string
+ /// </summary>
+ [Test]
+ public void SettingValueMultipeTimes()
+ {
+ MySqlConnectionStringBuilder s = new MySqlConnectionStringBuilder();
+ s["database"] = "test";
+ s["database"] = "test2";
+ Assert.AreEqual("database=test2", s.GetConnectionString(false));
+ }
}
}
Modified: branches/5.1/TestSuite/Source/PreparedStatements.cs
===================================================================
--- branches/5.1/TestSuite/Source/PreparedStatements.cs 2008-07-11 21:52:16 UTC (rev 1336)
+++ branches/5.1/TestSuite/Source/PreparedStatements.cs 2008-07-11 22:04:56 UTC (rev 1337)
@@ -28,6 +28,12 @@
[TestFixture]
public class PreparedStatements : BaseTest
{
+ protected override void FixtureSetup()
+ {
+ csAdditions = ";ignore prepare=false;";
+ base.FixtureSetup();
+ }
+
protected override void Setup()
{
base.Setup();
@@ -779,6 +785,39 @@
Assert.AreEqual(initialCount, GetPreparedStatementCount());
}
}
+
+ /// <summary>
+ /// Bug #37968 Prepared statements byte/tinyint causes data corruption.
+ /// </summary>
+ [Test]
+ public void InsertingUnsignedTinyInt()
+ {
+ execSQL("DROP TABLE IF EXISTS Test");
+ execSQL(@"CREATE TABLE Test(id TINYINT UNSIGNED NOT NULL,
+ id2 INT UNSIGNED, id3 TINYINT UNSIGNED, id4 INT UNSIGNED NOT NULL)");
+
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (?id, ?id2, ?id3, ?id4)", conn);
+ cmd.Parameters.Add("?id", MySqlDbType.UByte);
+ cmd.Parameters.Add("?id2", MySqlDbType.UByte);
+ cmd.Parameters.Add("?id3", MySqlDbType.UByte);
+ cmd.Parameters.Add("?id4", MySqlDbType.UByte);
+ cmd.Prepare();
+
+ cmd.Parameters[0].Value = 127;
+ cmd.Parameters[1].Value = 1;
+ cmd.Parameters[2].Value = 2;
+ cmd.Parameters[3].Value = 3;
+ cmd.ExecuteNonQuery();
+
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
+ DataTable dt = new DataTable();
+ da.Fill(dt);
+ Assert.AreEqual(1, dt.Rows.Count);
+ Assert.AreEqual(127, dt.Rows[0][0]);
+ Assert.AreEqual(1, dt.Rows[0][1]);
+ Assert.AreEqual(2, dt.Rows[0][2]);
+ Assert.AreEqual(3, dt.Rows[0][3]);
+ }
}
#region Configs
| Thread |
|---|
| • Connector/NET commit: r1337 - in branches/5.1: . Driver Driver/Source Driver/Source/Types TestSuite/Source | rburnett | 12 Jul |