Modified:
branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs
Log:
small tweak to the fix for bug #40231. The argument to lock must always be non-null
Modified: branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs 2008-11-11 21:58:54 UTC (rev 1450)
+++ branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs 2008-11-11 22:03:05 UTC (rev 1451)
@@ -34,8 +34,8 @@
internal class CharSetMap
{
#if NET20
- private static Dictionary<string, string> defaultCollations;
- private static Dictionary<string, int> maxLengths;
+ private static Dictionary<string, string> defaultCollations = new Dictionary<string, string>();
+ private static Dictionary<string, int> maxLengths = new Dictionary<string, int>();
private static Dictionary<string, CharacterSet> mapping;
#else
private static Hashtable mapping;
@@ -150,9 +150,6 @@
internal static void InitCollections(MySqlConnection connection)
{
- defaultCollations = new Dictionary<string, string>();
- maxLengths = new Dictionary<string, int>();
-
MySqlCommand cmd = new MySqlCommand("SHOW CHARSET", connection);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
@@ -168,7 +165,7 @@
{
lock (defaultCollations)
{
- if (defaultCollations == null)
+ if (defaultCollations.Count == 0)
InitCollections(connection);
}
if (!defaultCollations.ContainsKey(charset))
@@ -182,7 +179,7 @@
// is on the same lock as us.
lock (defaultCollations)
{
- if (maxLengths == null)
+ if (maxLengths.Count == 0)
InitCollections(connection);
}
| Thread |
|---|
| • Connector/NET commit: r1451 - branches/5.2/MySql.Data/Provider/Source | rburnett | 11 Nov |