List:Commits« Previous MessageNext Message »
From:Julio Casal Date:June 20 2011 1:37pm
Subject:bzr commit into connector-net-6.2 branch (julio.casal:951)
View as plain text  
#At file:///D:/Users/jcasalt/Dev/connector-net/6.2/ based on revid:julio.casal@stripped

  951 Julio Casal	2011-06-20
      Modified DbConnectionStringBuilder.ConnectionString (CF only class) to build the connection string each time Get is called. The private connectionString variable was removed.

    modified:
      MySql.Data/Provider/Source/base/DbConnectionStringBuilder.cs
=== modified file 'MySql.Data/Provider/Source/base/DbConnectionStringBuilder.cs'
--- a/MySql.Data/Provider/Source/base/DbConnectionStringBuilder.cs	2010-08-18 19:48:34 +0000
+++ b/MySql.Data/Provider/Source/base/DbConnectionStringBuilder.cs	2011-06-20 13:37:58 +0000
@@ -24,12 +24,12 @@ using System;
 using System.Collections;
 using System.ComponentModel;
 using System.Text;
+using System.Globalization;
 
 namespace MySql.Data.MySqlClient
 {
     public class DbConnectionStringBuilder : IDictionary, ICollection, IEnumerable, ICustomTypeDescriptor
 	{
-        private string connectionString;
         private Hashtable hash;
         private bool browsable;
 
@@ -49,12 +49,11 @@ namespace MySql.Data.MySqlClient
         
         public string ConnectionString 
         {
-            get { return connectionString; }
+            get { return GetConnectionString(); }
             set 
             {
                 Clear();
                 ParseConnectionString(value);
-                connectionString = value; 
             }
         }
 
@@ -71,12 +70,10 @@ namespace MySql.Data.MySqlClient
         public void Add(object key, object value)
         {
             hash[key] = value;
-            //TODO: update connection string
         }
 
         public virtual void Clear()
         {
-            connectionString = null;
             hash.Clear();
         }
 
@@ -108,7 +105,6 @@ namespace MySql.Data.MySqlClient
         public void Remove(object key)
         {
             hash.Remove(key);
-            //TODO: update connection string
         }
 
         public ICollection Values
@@ -282,6 +278,19 @@ namespace MySql.Data.MySqlClient
             return value;
         }
 
+        private string GetConnectionString()
+        {
+            StringBuilder builder = new StringBuilder();
+            string delimiter = "";
+            foreach (string key in this.Keys)
+            {
+                builder.AppendFormat(CultureInfo.CurrentCulture, "{0}{1}={2}",
+                    delimiter, key, this[key]);
+                delimiter = ";";
+            }
+            return builder.ToString();
+        }
+
 /*        private void ParseConnectionString(string value)
         {
             String[] keyvalues = src.Split(';');


Attachment: [text/bzr-bundle] bzr/julio.casal@oracle.com-20110620133758-swk0rjuc6nklx4bl.bundle
Thread
bzr commit into connector-net-6.2 branch (julio.casal:951) Julio Casal20 Jun