Forráskód Böngészése

2002-04-21 Daniel Morgan <[email protected]>

* System.Data.SqlClient/SqlCommand.cs: modified - to
compile using mcs.  This problem is
returning a stronger type in csc vs. msc

* System.Data.SqlClient/SqlConnection.cs: modified - msc
can not do a using PGconn = IntPtr; and then declare
with PGconn pgConn = IntPtr.Zero;
Thiw works under csc though.  Had to comment using and
changed declaration to IntPtr pgConn = IntPtr.Zero;
Also, got rid of compile warnings for hostaddr and port.

* System.Data.SqlClient/SqlErrorCollection.cs: modified - got
rid of compile warnings.  Commented MonoTODO attribute because mcs
doesn't seem to work with C# array property indexer (Item)
this[int index]

* System.Data.SqlClient/SqlParameterCollection.cs: modified -
commented MonoTODO attribute for indexer for mcs compiling

* Test/TestSqlIsolationLevel.cs:
* Test/TestSqlInsert.cs:
* Test/TestSqlException.cs: modified -
removed extra ExecuteNonQuery which caused two inserted rows

svn path=/trunk/mcs/; revision=3938
Daniel Morgan 24 éve
szülő
commit
a459b5d2cc

+ 15 - 3
mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs

@@ -103,7 +103,8 @@ namespace System.Data.SqlClient
 			String rowsAffectedString;
 
 			if(conn.State != ConnectionState.Open)
-				throw new InvalidOperationException("ConnnectionState is not Open");
+				throw new InvalidOperationException(
+					"ConnnectionState is not Open");
 
 			// FIXME: PQexec blocks 
 			// while PQsendQuery is non-blocking
@@ -265,7 +266,12 @@ namespace System.Data.SqlClient
 				// FIXME: throw an InvalidOperationException
 				// if the change was during a 
 				// transaction in progress
+
+				// csc
 				Connection = (SqlConnection) value; 
+				// mcs
+				// Connection = value; 
+				
 				// FIXME: set Transaction property to null
 			}
 		}
@@ -317,8 +323,14 @@ namespace System.Data.SqlClient
 			}
 
 			set { 
-				// FIXME: error handling
-				Transaction = (SqlTransaction) value; 
+				// FIXME: error handling - do not allow
+				// setting of transaction if transaction
+				// has already begun
+
+				// csc
+				Transaction = (SqlTransaction) value;
+				// mcs
+				// Transaction = value; 
 			}
 		}
 

+ 14 - 4
mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs

@@ -20,7 +20,7 @@ using System.Text;
 
 namespace System.Data.SqlClient
 {
-	using PGconn = IntPtr; 
+	// using PGconn = IntPtr; 
 	// PGconn is native C library type in libpq for Postgres Connection
 
 	// using PGressult = IntPtr;
@@ -38,7 +38,7 @@ namespace System.Data.SqlClient
 
 		#region Fields
 
-		private PGconn pgConn = IntPtr.Zero;    
+		private IntPtr pgConn = IntPtr.Zero;    
 		// PGConn (Postgres Connection)
 		private string connectionString = "";    
 		// OLE DB Connection String
@@ -233,9 +233,11 @@ namespace System.Data.SqlClient
 		private void OpenDataSource ()
 		{
 			if(dbname.Equals(""))
-				throw new InvalidOperationException("dbname missing");
+				throw new InvalidOperationException(
+					"dbname missing");
 			else if(conState == ConnectionState.Open)
-				throw new InvalidOperationException("ConnnectionState is already Open");
+				throw new InvalidOperationException(
+					"ConnnectionState is already Open");
 
 			ConnStatusType connStatus;
 
@@ -372,6 +374,14 @@ namespace System.Data.SqlClient
 					sParameter.Length - index - 1);
 
 				switch(parmKey.ToLower()) {
+				case "hostaddr":
+					hostaddr = parmValue;
+					break;
+
+				case "port":
+					port = parmValue;
+					break;
+
 				case "host":
 					// set DataSource property
 					host = parmValue;

+ 2 - 3
mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs

@@ -20,7 +20,6 @@ namespace System.Data.SqlClient
 	[MonoTODO]
 	public sealed class SqlErrorCollection : ICollection, IEnumerable
 	{
-		private int count = 0;
 		ArrayList errorList = new ArrayList();
 
 		internal SqlErrorCollection() {
@@ -67,9 +66,9 @@ namespace System.Data.SqlClient
 		public IEnumerator GetEnumerator() {
 			throw new NotImplementedException ();
 		}
-
-		[MonoTODO]
+		
 		// Index property (indexer)
+		// [MonoTODO]
 		public SqlError this[int index] {
 			get {
 				return (SqlError) errorList[index];

+ 3 - 2
mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs

@@ -41,7 +41,7 @@ namespace System.Data.SqlClient
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
+		// [MonoTODO]
 		public object this[string parameterName]
 		{
 			get { throw new NotImplementedException (); }
@@ -169,6 +169,7 @@ namespace System.Data.SqlClient
 			}			  
 		}
 
+		// [MonoTODO]
 		object IList.this[int index] {
 			get {	
 				throw new NotImplementedException ();
@@ -179,7 +180,7 @@ namespace System.Data.SqlClient
 			}			  
 		}
 
-		[MonoTODO]
+		// [MonoTODO]
 		public SqlParameter this[int index] {
 			get {	
 				throw new NotImplementedException ();

+ 15 - 3
mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs

@@ -103,7 +103,8 @@ namespace System.Data.SqlClient
 			String rowsAffectedString;
 
 			if(conn.State != ConnectionState.Open)
-				throw new InvalidOperationException("ConnnectionState is not Open");
+				throw new InvalidOperationException(
+					"ConnnectionState is not Open");
 
 			// FIXME: PQexec blocks 
 			// while PQsendQuery is non-blocking
@@ -265,7 +266,12 @@ namespace System.Data.SqlClient
 				// FIXME: throw an InvalidOperationException
 				// if the change was during a 
 				// transaction in progress
+
+				// csc
 				Connection = (SqlConnection) value; 
+				// mcs
+				// Connection = value; 
+				
 				// FIXME: set Transaction property to null
 			}
 		}
@@ -317,8 +323,14 @@ namespace System.Data.SqlClient
 			}
 
 			set { 
-				// FIXME: error handling
-				Transaction = (SqlTransaction) value; 
+				// FIXME: error handling - do not allow
+				// setting of transaction if transaction
+				// has already begun
+
+				// csc
+				Transaction = (SqlTransaction) value;
+				// mcs
+				// Transaction = value; 
 			}
 		}
 

+ 14 - 4
mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs

@@ -20,7 +20,7 @@ using System.Text;
 
 namespace System.Data.SqlClient
 {
-	using PGconn = IntPtr; 
+	// using PGconn = IntPtr; 
 	// PGconn is native C library type in libpq for Postgres Connection
 
 	// using PGressult = IntPtr;
@@ -38,7 +38,7 @@ namespace System.Data.SqlClient
 
 		#region Fields
 
-		private PGconn pgConn = IntPtr.Zero;    
+		private IntPtr pgConn = IntPtr.Zero;    
 		// PGConn (Postgres Connection)
 		private string connectionString = "";    
 		// OLE DB Connection String
@@ -233,9 +233,11 @@ namespace System.Data.SqlClient
 		private void OpenDataSource ()
 		{
 			if(dbname.Equals(""))
-				throw new InvalidOperationException("dbname missing");
+				throw new InvalidOperationException(
+					"dbname missing");
 			else if(conState == ConnectionState.Open)
-				throw new InvalidOperationException("ConnnectionState is already Open");
+				throw new InvalidOperationException(
+					"ConnnectionState is already Open");
 
 			ConnStatusType connStatus;
 
@@ -372,6 +374,14 @@ namespace System.Data.SqlClient
 					sParameter.Length - index - 1);
 
 				switch(parmKey.ToLower()) {
+				case "hostaddr":
+					hostaddr = parmValue;
+					break;
+
+				case "port":
+					port = parmValue;
+					break;
+
 				case "host":
 					// set DataSource property
 					host = parmValue;

+ 2 - 3
mcs/class/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs

@@ -20,7 +20,6 @@ namespace System.Data.SqlClient
 	[MonoTODO]
 	public sealed class SqlErrorCollection : ICollection, IEnumerable
 	{
-		private int count = 0;
 		ArrayList errorList = new ArrayList();
 
 		internal SqlErrorCollection() {
@@ -67,9 +66,9 @@ namespace System.Data.SqlClient
 		public IEnumerator GetEnumerator() {
 			throw new NotImplementedException ();
 		}
-
-		[MonoTODO]
+		
 		// Index property (indexer)
+		// [MonoTODO]
 		public SqlError this[int index] {
 			get {
 				return (SqlError) errorList[index];

+ 3 - 2
mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs

@@ -41,7 +41,7 @@ namespace System.Data.SqlClient
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
+		// [MonoTODO]
 		public object this[string parameterName]
 		{
 			get { throw new NotImplementedException (); }
@@ -169,6 +169,7 @@ namespace System.Data.SqlClient
 			}			  
 		}
 
+		// [MonoTODO]
 		object IList.this[int index] {
 			get {	
 				throw new NotImplementedException ();
@@ -179,7 +180,7 @@ namespace System.Data.SqlClient
 			}			  
 		}
 
-		[MonoTODO]
+		// [MonoTODO]
 		public SqlParameter this[int index] {
 			get {	
 				throw new NotImplementedException ();

+ 31 - 0
mcs/class/System.Data/ChangeLog

@@ -1,3 +1,34 @@
+2002-04-21  Daniel Morgan <[email protected]>
+
+* System.Data.SqlClient/SqlCommand.cs: modified - to 
+compile using mcs.  This problem is
+returning a stronger type in csc vs. msc
+
+* System.Data.SqlClient/SqlConnection.cs: modified - msc
+can not do a using PGconn = IntPtr; and then declare
+with PGconn pgConn = IntPtr.Zero;
+Thiw works under csc though.  Had to comment using and
+changed declaration to IntPtr pgConn = IntPtr.Zero;
+Also, got rid of compile warnings for hostaddr and port.
+
+* System.Data.SqlClient/SqlErrorCollection.cs: modified - got
+rid of compile warnings.  Commented MonoTODO attribute because mcs
+doesn't seem to work with C# array property indexer (Item)
+this[int index]
+
+* System.Data.SqlClient/SqlParameterCollection.cs: modified -
+commented MonoTODO attribute for indexer for mcs compiling
+
+* Test/TestSqlIsolationLevel.cs:
+* Test/TestSqlInsert.cs:
+* Test/TestSqlException.cs: modified -
+removed extra ExecuteNonQuery which caused two inserted rows
+
+2002-04-20  Daniel Morgan <[email protected]>
+
+* System.Data/StateChangeEventArgs.cs - added
+needed to compile System.Data.dll with mcs.  
+
 2002-04-20  Daniel Morgan <[email protected]>
 
 * System.Data.OleDb: added directory - for OleDb database 

+ 15 - 3
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs

@@ -103,7 +103,8 @@ namespace System.Data.SqlClient
 			String rowsAffectedString;
 
 			if(conn.State != ConnectionState.Open)
-				throw new InvalidOperationException("ConnnectionState is not Open");
+				throw new InvalidOperationException(
+					"ConnnectionState is not Open");
 
 			// FIXME: PQexec blocks 
 			// while PQsendQuery is non-blocking
@@ -265,7 +266,12 @@ namespace System.Data.SqlClient
 				// FIXME: throw an InvalidOperationException
 				// if the change was during a 
 				// transaction in progress
+
+				// csc
 				Connection = (SqlConnection) value; 
+				// mcs
+				// Connection = value; 
+				
 				// FIXME: set Transaction property to null
 			}
 		}
@@ -317,8 +323,14 @@ namespace System.Data.SqlClient
 			}
 
 			set { 
-				// FIXME: error handling
-				Transaction = (SqlTransaction) value; 
+				// FIXME: error handling - do not allow
+				// setting of transaction if transaction
+				// has already begun
+
+				// csc
+				Transaction = (SqlTransaction) value;
+				// mcs
+				// Transaction = value; 
 			}
 		}
 

+ 14 - 4
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs

@@ -20,7 +20,7 @@ using System.Text;
 
 namespace System.Data.SqlClient
 {
-	using PGconn = IntPtr; 
+	// using PGconn = IntPtr; 
 	// PGconn is native C library type in libpq for Postgres Connection
 
 	// using PGressult = IntPtr;
@@ -38,7 +38,7 @@ namespace System.Data.SqlClient
 
 		#region Fields
 
-		private PGconn pgConn = IntPtr.Zero;    
+		private IntPtr pgConn = IntPtr.Zero;    
 		// PGConn (Postgres Connection)
 		private string connectionString = "";    
 		// OLE DB Connection String
@@ -233,9 +233,11 @@ namespace System.Data.SqlClient
 		private void OpenDataSource ()
 		{
 			if(dbname.Equals(""))
-				throw new InvalidOperationException("dbname missing");
+				throw new InvalidOperationException(
+					"dbname missing");
 			else if(conState == ConnectionState.Open)
-				throw new InvalidOperationException("ConnnectionState is already Open");
+				throw new InvalidOperationException(
+					"ConnnectionState is already Open");
 
 			ConnStatusType connStatus;
 
@@ -372,6 +374,14 @@ namespace System.Data.SqlClient
 					sParameter.Length - index - 1);
 
 				switch(parmKey.ToLower()) {
+				case "hostaddr":
+					hostaddr = parmValue;
+					break;
+
+				case "port":
+					port = parmValue;
+					break;
+
 				case "host":
 					// set DataSource property
 					host = parmValue;

+ 2 - 3
mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs

@@ -20,7 +20,6 @@ namespace System.Data.SqlClient
 	[MonoTODO]
 	public sealed class SqlErrorCollection : ICollection, IEnumerable
 	{
-		private int count = 0;
 		ArrayList errorList = new ArrayList();
 
 		internal SqlErrorCollection() {
@@ -67,9 +66,9 @@ namespace System.Data.SqlClient
 		public IEnumerator GetEnumerator() {
 			throw new NotImplementedException ();
 		}
-
-		[MonoTODO]
+		
 		// Index property (indexer)
+		// [MonoTODO]
 		public SqlError this[int index] {
 			get {
 				return (SqlError) errorList[index];

+ 3 - 2
mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs

@@ -41,7 +41,7 @@ namespace System.Data.SqlClient
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
+		// [MonoTODO]
 		public object this[string parameterName]
 		{
 			get { throw new NotImplementedException (); }
@@ -169,6 +169,7 @@ namespace System.Data.SqlClient
 			}			  
 		}
 
+		// [MonoTODO]
 		object IList.this[int index] {
 			get {	
 				throw new NotImplementedException ();
@@ -179,7 +180,7 @@ namespace System.Data.SqlClient
 			}			  
 		}
 
-		[MonoTODO]
+		// [MonoTODO]
 		public SqlParameter this[int index] {
 			get {	
 				throw new NotImplementedException ();

+ 2 - 3
mcs/class/System.Data/Test/TestSqlException.cs

@@ -48,12 +48,12 @@ namespace TestSystemDataSqlClient
 				"password=viewsonic";
 
 			insertStatement = 
-				"insert into sometable " +
+				"insert into NoSuchTable " +
 				"(tid, tdesc) " +
 				"values ('beer', 'Beer for All!') ";
 
 			deleteStatement = 
-				"delete from NoSuchTable " +
+				"delete from sometable " +
 				"where tid = 'beer' ";
 
 			try {
@@ -73,7 +73,6 @@ namespace TestSystemDataSqlClient
 
 				// execute the DELETE SQL command
 				Console.WriteLine ("Execute DELETE SQL Command...");
-				cmd.ExecuteNonQuery();
 				rowsAffected = cmd.ExecuteNonQuery();
 				Console.WriteLine ("Rows Affected: " + rowsAffected);
 

+ 0 - 2
mcs/class/System.Data/Test/TestSqlInsert.cs

@@ -73,7 +73,6 @@ namespace TestSystemDataSqlClient
 
 			// execute the DELETE SQL command
 			Console.WriteLine ("Execute DELETE SQL Command...");
-			cmd.ExecuteNonQuery();
 			rowsAffected = cmd.ExecuteNonQuery();
 			Console.WriteLine ("Rows Affected: " + rowsAffected);
 
@@ -83,7 +82,6 @@ namespace TestSystemDataSqlClient
 
 			// execute the INSERT SQL command
 			Console.WriteLine ("Execute INSERT SQL Command...");
-			cmd.ExecuteNonQuery();
 			rowsAffected = cmd.ExecuteNonQuery();
 			Console.WriteLine ("Rows Affected: " + rowsAffected);
 

+ 2 - 1
mcs/class/System.Data/Test/TestSqlIsolationLevel.cs

@@ -72,7 +72,8 @@ namespace TestSystemDataSqlClient
 
 			// execute the DELETE SQL command
 			Console.WriteLine ("Execute DELETE SQL Command...");
-			cmd.ExecuteNonQuery();
+			rowsAffected = cmd.ExecuteNonQuery();
+			Console.WriteLine ("Rows Affected: " + rowsAffected);
 
 			// change the SQL command to an SQL INSERT Command
 			Console.WriteLine ("Now use INSERT SQL Command...");