Преглед на файлове

Fix NET_2_0 build.

svn path=/trunk/mcs/; revision=33837
Sebastien Pouliot преди 21 години
родител
ревизия
de76dcbb20

+ 104 - 1
mcs/class/System.Data/System.Data.Common/DbConnectionOptions.cs

@@ -33,6 +33,7 @@
 
 using System.Collections;
 using System.Collections.Specialized;
+using System.Security;
 using System.Text;
 
 namespace System.Data.Common {
@@ -42,11 +43,16 @@ namespace System.Data.Common {
 		#region Fields
 
 		internal NameValueCollection options;
+		internal string normalizedConnectionString;
 
 		#endregion // Fields
 
 		#region Constructors
 
+		internal DbConnectionOptions ()
+		{
+		}
+
 		[MonoTODO]
 		protected internal DbConnectionOptions (DbConnectionOptions connectionOptions)
 		{
@@ -61,7 +67,7 @@ namespace System.Data.Common {
 		}
 		
 		[MonoTODO]
-		public DbConnectionString (string connectionString, Hashtable synonyms, bool useFirstKeyValuePair)
+		public DbConnectionOptions (string connectionString, Hashtable synonyms, bool useFirstKeyValuePair)
 			: this (connectionString)
 		{
 		}
@@ -149,6 +155,103 @@ namespace System.Data.Common {
 			throw new NotImplementedException ();
 		}
 
+		internal void ParseConnectionString (string connectionString)
+		{
+			if (connectionString.Length == 0)
+				return;
+
+			connectionString += ";";
+
+			bool inQuote = false;
+			bool inDQuote = false;
+			bool inName = true;
+
+			string name = String.Empty;
+			string value = String.Empty;
+			StringBuilder sb = new StringBuilder ();
+
+			for (int i = 0; i < connectionString.Length; i += 1) {
+				char c = connectionString [i];
+				char peek;
+				if (i == connectionString.Length - 1)
+					peek = '\0';
+				else 
+					peek = connectionString [i + 1];
+
+				switch (c) {
+				case '\'':
+					if (inDQuote) 
+						sb.Append (c);
+					else if (peek.Equals (c)) {
+						sb.Append (c);
+						i += 1;
+					}
+					else 
+						inQuote = !inQuote;
+					break;
+				case '"':
+					if (inQuote) 
+						sb.Append (c);
+					else if (peek.Equals (c)) {
+						sb.Append (c);
+						i += 1;
+					}
+					else 
+						inDQuote = !inDQuote;
+					break;
+				case ';':
+					if (inDQuote || inQuote)
+						sb.Append (c);
+					else {
+						if (name != String.Empty && name != null) {
+							value = sb.ToString ();
+							// FIXME - KeywordLookup is an NOP
+							// options [KeywordLookup (name.Trim ())] = value;
+							options [name.Trim ()] = value;
+						}
+						inName = true;
+						name = String.Empty;
+						value = String.Empty;
+						sb = new StringBuilder ();
+					}
+					break;
+				case '=':
+					if (inDQuote || inQuote || !inName)
+						sb.Append (c);
+					else if (peek.Equals (c)) {
+						sb.Append (c);
+						i += 1;
+					} 
+					else {
+						name = sb.ToString ();
+						sb = new StringBuilder ();
+						inName = false;
+					}
+					break;
+				case ' ':
+					if (inQuote || inDQuote)
+						sb.Append (c);
+					else if (sb.Length > 0 && !peek.Equals (';'))
+						sb.Append (c);
+					break;
+				default:
+					sb.Append (c);
+					break;
+				}
+			}	
+			
+			StringBuilder normalized = new StringBuilder ();
+			ArrayList keys = new ArrayList ();
+			keys.AddRange (Keys);
+			keys.Sort ();
+			foreach (string key in keys)
+			{
+				string entry = String.Format ("{0}=\"{1}\";", key, this [key].Replace ("\"", "\"\""));
+				normalized.Append (entry);
+			}
+			normalizedConnectionString = normalized.ToString ();
+		}
+
 		#endregion // Methods
 	}
 }

+ 1 - 97
mcs/class/System.Data/System.Data.Common/DbConnectionString.cs

@@ -43,8 +43,6 @@ namespace System.Data.Common {
 		#region Fields
 
 		KeyRestrictionBehavior behavior;
-		string normalizedConnectionString;
-		internal NameValueCollection options;
 
 		#endregion // Fields
 
@@ -58,6 +56,7 @@ namespace System.Data.Common {
 
 		[MonoTODO]
 		public DbConnectionString (string connectionString)
+			: base (connectionString)
 		{
 			options = new NameValueCollection ();
 			ParseConnectionString (connectionString);
@@ -103,101 +102,6 @@ namespace System.Data.Common {
 			return keyname;
 		}
 
-		internal void ParseConnectionString (string connectionString)
-		{
-			if (connectionString.Length == 0)
-				return;
-
-			connectionString += ";";
-
-			bool inQuote = false;
-			bool inDQuote = false;
-			bool inName = true;
-
-			string name = String.Empty;
-			string value = String.Empty;
-			StringBuilder sb = new StringBuilder ();
-
-			for (int i = 0; i < connectionString.Length; i += 1) {
-				char c = connectionString [i];
-				char peek;
-				if (i == connectionString.Length - 1)
-					peek = '\0';
-				else 
-					peek = connectionString [i + 1];
-
-				switch (c) {
-				case '\'':
-					if (inDQuote) 
-						sb.Append (c);
-					else if (peek.Equals (c)) {
-						sb.Append (c);
-						i += 1;
-					}
-					else 
-						inQuote = !inQuote;
-					break;
-				case '"':
-					if (inQuote) 
-						sb.Append (c);
-					else if (peek.Equals (c)) {
-						sb.Append (c);
-						i += 1;
-					}
-					else 
-						inDQuote = !inDQuote;
-					break;
-				case ';':
-					if (inDQuote || inQuote)
-						sb.Append (c);
-					else {
-						if (name != String.Empty && name != null) {
-							value = sb.ToString ();
-							options [KeywordLookup (name.Trim ())] = value;
-						}
-						inName = true;
-						name = String.Empty;
-						value = String.Empty;
-						sb = new StringBuilder ();
-					}
-					break;
-				case '=':
-					if (inDQuote || inQuote || !inName)
-						sb.Append (c);
-					else if (peek.Equals (c)) {
-						sb.Append (c);
-						i += 1;
-					} 
-					else {
-						name = sb.ToString ();
-						sb = new StringBuilder ();
-						inName = false;
-					}
-					break;
-				case ' ':
-					if (inQuote || inDQuote)
-						sb.Append (c);
-					else if (sb.Length > 0 && !peek.Equals (';'))
-						sb.Append (c);
-					break;
-				default:
-					sb.Append (c);
-					break;
-				}
-			}	
-			
-			StringBuilder normalized = new StringBuilder ();
-			ArrayList keys = new ArrayList ();
-			keys.AddRange (Keys);
-			keys.Sort ();
-			foreach (string key in keys)
-			{
-				string entry = String.Format ("{0}=\"{1}\";", key, this [key].Replace ("\"", "\"\""));
-				normalized.Append (entry);
-			}
-			normalizedConnectionString = normalized.ToString ();
-		}
-
 		[MonoTODO]
 		public virtual void PermissionDemand ()
 		{

+ 2 - 2
mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs

@@ -103,14 +103,14 @@ namespace System.Data.Common {
 		#region // Methods
 #if NET_2_0
 		[MonoTODO ("configurable ? why is this in the attribute class ?")]
-		[EditorBrowsableAttribute (false)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
 		public bool ShouldSerializeConnectionString ()
 		{
 			return false;
 		}
 
 		[MonoTODO ("configurable ? why is this in the attribute class ?")]
-		[EditorBrowsableAttribute (false)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
 		public bool ShouldSerializeKeyRestrictions ()
 		{
 			return false;

+ 3 - 1
mcs/class/System.Data/System.Data.Odbc/OdbcPermission.cs

@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Collections;
 using System.Data.Common;
 using System.Security;
 using System.Security.Permissions;
@@ -55,8 +56,9 @@ namespace System.Data.Odbc {
 		[Obsolete ("use OdbcPermission(PermissionState.None)", true)]
 #endif
 		public OdbcPermission (PermissionState state, bool allowBlankPassword)
-			: base (state, allowBlankPassword)
+			: base (state)
 		{
+			AllowBlankPassword = allowBlankPassword;
 		}
 
 		// required for Copy method

+ 2 - 1
mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs

@@ -60,8 +60,9 @@ namespace System.Data.OleDb {
                 [Obsolete ("use OleDbPermission(PermissionState.None)", true)]
 #endif
 		public OleDbPermission (PermissionState state, bool allowBlankPassword)
-			: base (state, allowBlankPassword)
+			: base (state)
 		{
+			AllowBlankPassword = allowBlankPassword;
 		}
 
 		// required for Copy method

+ 5 - 3
mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs

@@ -31,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Collections;
 using System.Data.Common;
 using System.Security;
 using System.Security.Permissions;
@@ -62,8 +63,9 @@ namespace System.Data.SqlClient {
 
 		[Obsolete ("Use SqlClientPermission(PermissionState.None)", true)]
 		public SqlClientPermission (PermissionState state, bool allowBlankPassword) 
-			: base (state, allowBlankPassword)
+			: base (state)
 		{
+			AllowBlankPassword = allowBlankPassword;
 		}
 
 		// required for Copy method
@@ -83,10 +85,10 @@ namespace System.Data.SqlClient {
 
 #if NET_2_0
 		[MonoTODO ("overridden for what ? additional validations ???")]
-		protected virtual void AddConnectionString (string connectionString, string restrictions, 
+		protected override void AddConnectionString (string connectionString, string restrictions, 
 			KeyRestrictionBehavior behavior, Hashtable synonyms, bool useFirstKeyValue)
 		{
-			base.Add (connectionString, restrictions, behavior, synonyms, useFirstKeyValue);
+			base.AddConnectionString (connectionString, restrictions, behavior, synonyms, useFirstKeyValue);
 		}
 #else
 		[MonoTODO ("overridden for what ? additional validations ???")]