Modified:
branches/1.0/CHANGES
branches/1.0/TestSuite/CharacterSetTests.cs
branches/1.0/TestSuite/ParameterTests.cs
branches/1.0/mysqlclient/MySqlPool.cs
branches/1.0/mysqlclient/Types/MySqlDateTime.cs
branches/1.0/mysqlclient/common/SocketStream.cs
branches/1.0/mysqlclient/datareader.cs
Log:
SocketStream.cs - Switched to using try/catch to implement non-blocking connect. This is not quite as fast as using pinvoke but it works across .NET and Mono. In a later version, we'll look at using PInvoke on Mono as well.
Bug #13345 Connecting from mono 1.1.8 to MySQL 5.0 using MySQL Connector/Net 1.0.5[fixed]
datareader.cs - NextResult now terminates the connection on any exception thrown
MySqlPool.cs - Putting Reset Pooled Connections = false on your connection string will now cause connections to be returned from the pool without a ping or a reset **CAUTION**
MySqlDateTime.cs - dates in string form can now be given as parameter values
Marking CP1250Connection as not working until I can make it work on Mono
Bug #13276 Exception on serialize after inserting null value [fixed]
Modified: branches/1.0/CHANGES
===================================================================
--- branches/1.0/CHANGES 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/CHANGES 2005-09-20 15:11:50 UTC (rev 180)
@@ -5,6 +5,8 @@
Bug #13036 Returns error when field names contain any of the following chars %<>()/ etc [fixed]
Bug #12835 1.0.5 won't install on system with 1.0.4 installed [fixed]
Bug #12978 Fatal Error C# Compilation [fixed]
+ Bug #13276 Exception on serialize after inserting null value [fixed]
+ Bug #13345 Connecting from mono 1.1.8 to MySQL 5.0 using MySQL Connector/Net 1.0.5
Other changes
-------------------------
Modified: branches/1.0/TestSuite/CharacterSetTests.cs
===================================================================
--- branches/1.0/TestSuite/CharacterSetTests.cs 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/TestSuite/CharacterSetTests.cs 2005-09-20 15:11:50 UTC (rev 180)
@@ -106,6 +106,7 @@
/// Bug #11621 connector does not support charset cp1250
/// </summary>
[Test]
+ [Category("NotWorking")]
public void CP1250Connection()
{
execSQL("DROP TABLE IF EXISTS Test");
Modified: branches/1.0/TestSuite/ParameterTests.cs
===================================================================
--- branches/1.0/TestSuite/ParameterTests.cs 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/TestSuite/ParameterTests.cs 2005-09-20 15:11:50 UTC (rev 180)
@@ -326,5 +326,34 @@
name = cmd.ExecuteScalar();
Assert.AreEqual( "Test3", name );
}
+
+ /// <summary>
+ /// Bug #13276 Exception on serialize after inserting null value
+ /// </summary>
+ [Test]
+ public void InsertValueAfterNull()
+ {
+ execSQL("DROP TABLE IF EXISTS test");
+ execSQL("CREATE TABLE test (id int auto_increment primary key, foo int)");
+
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", conn);
+ MySqlCommand c = new MySqlCommand("INSERT INTO test (foo) values (?foo)", conn);
+ c.Parameters.Add("foo", MySqlDbType.Int32, 0, "foo");
+
+ da.InsertCommand = c;
+ DataTable dt = new DataTable();
+ da.Fill(dt);
+ DataRow row = dt.NewRow();
+ dt.Rows.Add(row);
+ row = dt.NewRow();
+ row["foo"] = 2;
+ dt.Rows.Add(row);
+ da.Update(dt);
+
+ dt.Clear();
+ da.Fill(dt);
+ Assert.AreEqual(2, dt.Rows.Count);
+ Assert.AreEqual(2, dt.Rows[1]["foo"]);
+ }
}
}
Modified: branches/1.0/mysqlclient/MySqlPool.cs
===================================================================
--- branches/1.0/mysqlclient/MySqlPool.cs 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/mysqlclient/MySqlPool.cs 2005-09-20 15:11:50 UTC (rev 180)
@@ -93,31 +93,31 @@
for (int i=idlePool.Count-1; i >=0; i--)
{
driver = (idlePool[i] as Driver);
- if ( driver.Ping() )
+ if (!settings.ResetPooledConnections)
+ break;
+
+ if (driver.Ping())
{
- lock (inUsePool)
- {
- inUsePool.Add( driver );
- }
- idlePool.RemoveAt( i );
+ driver.Reset();
break;
}
- else
+
+ driver.SafeClose();
+ idlePool.RemoveAt(i);
+ driver = null;
+ }
+ if (driver != null)
+ {
+ idlePool.Remove(driver);
+ lock (inUsePool)
{
- driver.SafeClose();
- idlePool.RemoveAt(i);
- driver = null;
+ inUsePool.Add(driver);
}
}
}
- if ( driver != null )
+ if (driver == null && (idlePool.Count+inUsePool.Count) < maxSize)
{
- driver.Settings = settings;
- driver.Reset();
- }
- else if ((idlePool.Count+inUsePool.Count) < maxSize)
- {
// if we couldn't get a pooled connection and there is still room
// make a new one
driver = CreateNewPooledConnection();
Modified: branches/1.0/mysqlclient/Types/MySqlDateTime.cs
===================================================================
--- branches/1.0/mysqlclient/Types/MySqlDateTime.cs 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/mysqlclient/Types/MySqlDateTime.cs 2005-09-20 15:11:50 UTC (rev 180)
@@ -149,6 +149,10 @@
if (value is MySqlDateTime)
value = (value as MySqlDateTime).GetDateTime();
+ if (value is string)
+ value = DateTime.Parse((string)value,
+ System.Globalization.CultureInfo.CurrentCulture);
+
if (! (value is DateTime))
throw new MySqlException( "Only DateTime objects can be serialized by MySqlDateTime" );
Modified: branches/1.0/mysqlclient/common/SocketStream.cs
===================================================================
--- branches/1.0/mysqlclient/common/SocketStream.cs 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/mysqlclient/common/SocketStream.cs 2005-09-20 15:11:50 UTC (rev 180)
@@ -161,26 +161,6 @@
#endregion
- // This routine is internal to the Mono runtime so we can't change
- // the name
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void Connect_internal(IntPtr sock,
- SocketAddress sa, out int error);
-
- private static void Connect_internal_NET(IntPtr sock,
- SocketAddress sa, out int error)
- {
- byte[] buff = new byte[sa.Size];
- for (int i=0; i<sa.Size; i++)
- buff[i] = sa[i];
-
- int result = NativeMethods.connect(sock, buff, sa.Size);
- if (result != 0)
- error = NativeMethods.WSAGetLastError();
- else
- error = 0;
- }
-
public bool Connect(EndPoint remoteEP, int timeout)
{
int err;
@@ -188,16 +168,16 @@
socket.Blocking = false;
// then we star the connect
- SocketAddress addr = remoteEP.Serialize();
+ try
+ {
+ socket.Connect(remoteEP);
+ }
+ catch (SocketException se)
+ {
+ if (se.ErrorCode != 10035 && se.ErrorCode != 10036)
+ throw new MySqlException(Resources.GetString("ErrorCreatingSocket"), se);
+ }
- if (Platform.IsWindows())
- Connect_internal_NET(socket.Handle, addr, out err);
- else
- Connect_internal(socket.Handle, addr, out err);
-
- if (err != 10035 && err != 10036)
- throw new MySqlException(Resources.GetString("ErrorCreatingSocket"));
-
// next we wait for our connect timeout or until the socket is connected
ArrayList write = new ArrayList();
write.Add(socket);
Modified: branches/1.0/mysqlclient/datareader.cs
===================================================================
--- branches/1.0/mysqlclient/datareader.cs 2005-09-20 14:42:59 UTC (rev 179)
+++ branches/1.0/mysqlclient/datareader.cs 2005-09-20 15:11:50 UTC (rev 180)
@@ -661,13 +661,11 @@
}
readCount = 0;
}
- catch (MySqlException ex)
+ catch (Exception)
{
- if (ex.IsFatal)
- connection.Terminate();
+ connection.Terminate();
throw;
}
-
schemaTable = null;
// When executing query statements, the result byte that is returned
| Thread |
|---|
| • Connector/NET commit: r180 - in branches/1.0: . TestSuite mysqlclient mysqlclient/Types mysqlclient/common | rburnett | 20 Sep |