Added:
trunk/Driver/Source/common/Cache.cs
Modified:
trunk/CHANGES
trunk/Driver/Source/Connection.cs
Log:
Bug #28167 Poor performance building connection string
Solved this by introducing a type specific cache at the connection level. The cache holds
the last 25 connection strings to be used. This patch was based on a patch by a user.
Thanks Maxim!
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2007-05-02 20:59:46 UTC (rev 702)
+++ trunk/CHANGES 2007-05-02 21:00:14 UTC (rev 703)
@@ -23,6 +23,8 @@
Bug #25947 CreateFormat/CreateParameters Column of DataTypes collection incorrect for
CHAR
Bug #27765 Logging does not work
Bug #27679 MySqlCommandBuilder.DeriveParameters ignores UNSIGNED flag
+ Bug #27668 FillSchema and Stored Proc with an out parameter
+ Bug #28167 Poor performance building connection string (thanks Maxim!)
Other changes
-------------
Modified: trunk/Driver/Source/Connection.cs
===================================================================
--- trunk/Driver/Source/Connection.cs 2007-05-02 20:59:46 UTC (rev 702)
+++ trunk/Driver/Source/Connection.cs 2007-05-02 21:00:14 UTC (rev 703)
@@ -57,6 +57,8 @@
/// <include file='docs/MySqlConnection.xml' path='docs/InfoMessage/*'/>
public event MySqlInfoMessageEventHandler InfoMessage;
+ private static Cache connectionStringCache = new Cache(0, 25);
+
#if MONO2
/// <include file='docs/MySqlConnection.xml' path='docs/StateChange/*'/>
public event StateChangeEventHandler StateChange;
@@ -248,8 +250,18 @@
"Not allowed to change the 'ConnectionString' property while the
connection (state=" + State +
").");
- MySqlConnectionStringBuilder newSettings =
- new MySqlConnectionStringBuilder(value);
+ MySqlConnectionStringBuilder newSettings =
+ (MySqlConnectionStringBuilder)connectionStringCache[value];
+
+ if (null == newSettings)
//!globalConnectionStringCache.TryGetValue(value, out newSettings))
+ {
+ lock (connectionStringCache)
+ {
+ newSettings = new MySqlConnectionStringBuilder(value);
+ connectionStringCache.Add(value, newSettings);
+ }
+ }
+
settings = newSettings;
if (driver != null)
driver.Settings = newSettings;
Copied: trunk/Driver/Source/common/Cache.cs (from rev 701,
branches/5.0/Driver/Source/common/Cache.cs)
| Thread |
|---|
| • Connector/NET commit: r703 - in trunk: . Driver/Source Driver/Source/common | rburnett | 2 May |