Răsfoiți Sursa

2008-08-20 Daniel Morgan <[email protected]>

	* System.Data.OracleClient/OracleConnection.cs: allow 
	the use of a connection string which allows a
	TNS network description that is parentheses delimited
	like the following which has the hostname, port, and
	service name without requiring use of a TNSNAMES.ORA
	file.

User ID=SCOTT;Password=TIGER;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TESTDB)))

svn path=/trunk/mcs/; revision=111079
Daniel Morgan 17 ani în urmă
părinte
comite
5ac698cfe5

+ 11 - 0
mcs/class/System.Data.OracleClient/ChangeLog

@@ -1,3 +1,14 @@
+2008-08-20  Daniel Morgan <[email protected]>
+
+	* System.Data.OracleClient/OracleConnection.cs: allow 
+	the use of a connection string which allows a
+	TNS network description that is parentheses delimited
+	like the following which has the hostname, port, and
+	service name without requiring use of a TNSNAMES.ORA
+	file.
+
+User ID=SCOTT;Password=TIGER;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TESTDB)))
+
 2008-05-02  Gert Driesen  <[email protected]>
 
 	* System.Data.OracleClient_test.dll.sources: Added

+ 20 - 2
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs

@@ -485,6 +485,7 @@ namespace System.Data.OracleClient
 
 			bool inQuote = false;
 			bool inDQuote = false;
+			int inParen = 0;
 
 			string name = String.Empty;
 			StringBuilder sb = new StringBuilder ();
@@ -502,6 +503,14 @@ namespace System.Data.OracleClient
 				case '"' :
 					inDQuote = !inDQuote;
 					break;
+				case '(':
+					inParen++;
+					sb.Append (c);
+					break;
+				case ')':
+					inParen--;
+					sb.Append (c);
+					break;
 				case ';' :
 					if (!inDQuote && !inQuote) {
 						if (name != String.Empty && name != null) {
@@ -538,7 +547,7 @@ namespace System.Data.OracleClient
 						sb.Append (c);
 					break;
 				case '=' :
-					if (!inDQuote && !inQuote) {
+					if (!inDQuote && !inQuote && inParen == 0) {
 						name = sb.ToString ();
 						sb = new StringBuilder ();
 					}
@@ -575,6 +584,7 @@ namespace System.Data.OracleClient
 
 			bool inQuote = false;
 			bool inDQuote = false;
+			int inParen = 0;
 
 			string name = String.Empty;
 			string value = String.Empty;
@@ -588,6 +598,14 @@ namespace System.Data.OracleClient
 				case '"' :
 					inDQuote = !inDQuote;
 					break;
+				case '(':
+					inParen++;
+					sb.Append (c);
+					break;
+				case ')':
+					inParen--;
+					sb.Append (c);
+					break;
 				case ';' :
 					if (!inDQuote && !inQuote) {
 						if (name != String.Empty && name != null) {
@@ -603,7 +621,7 @@ namespace System.Data.OracleClient
 						sb.Append (c);
 					break;
 				case '=' :
-					if (!inDQuote && !inQuote) {
+					if (!inDQuote && !inQuote && inParen == 0) {
 						name = sb.ToString ();
 						sb = new StringBuilder ();
 					}