2002-05-23 Daniel Morgan <danmorg@sc.rr.com>
authorDaniel Morgan <monodanmorg@yahoo.com>
Thu, 23 May 2002 00:28:02 +0000 (00:28 -0000)
committerDaniel Morgan <monodanmorg@yahoo.com>
Thu, 23 May 2002 00:28:02 +0000 (00:28 -0000)
* System.Data.SqlClient/SqlCommand.cs: set
the "ProviderType" to the PostgreSQL type oid

* System.Data.SqlClient/SqlDataReader.cs: fix
for various properties and methods that
return meta data: Item indexers this[name] and this[index],
GetFieldType, GetName, and GetOrdinal.  SqlDataAdapter
should work again.

svn path=/trunk/mcs/; revision=4873

mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
mcs/class/System.Data/ChangeLog
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs

index e2224476c2296f13f69f8a1c2da4bd650936bd1f..d68d57bfa37727688eafb7dc0f08491010b85de2 100644 (file)
@@ -719,7 +719,7 @@ namespace System.Data.SqlClient {
                        dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
                        dataTableSchema.Columns.Add ("DataType", typeof(string));
                        dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
-                       dataTableSchema.Columns.Add ("ProviderType", typeof (string));
+                       dataTableSchema.Columns.Add ("ProviderType", typeof (int));
                        dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
                        dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
                        dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
@@ -763,7 +763,7 @@ namespace System.Data.SqlClient {
                                schemaRow["DataType"] = st;\r
 
                                schemaRow["AllowDBNull"] = false; // ? tim
-                               schemaRow["ProviderType"] = ""; // ? tim
+                               schemaRow["ProviderType"] = oid; // ? tim
                                schemaRow["IsAliased"] = false; // ? tim
                                schemaRow["IsExpression"] = false; // ? tim
                                schemaRow["IsIdentity"] = false; // ? tim
index 802bc3f39632a3af6cf7e416dfa0b85b63530852..6d55d61673a820f32770d4c089b88670181b21ab 100644 (file)
@@ -56,6 +56,8 @@ namespace System.Data.SqlClient {
                private int rows;
                private int cols;
 
+               private int recordsAffected = -1; // TODO: get this value
+
                private int currentRow = -1; // no Read() has been done yet
 
                #endregion // Fields
@@ -221,7 +223,8 @@ namespace System.Data.SqlClient {
                [MonoTODO]
                public Type GetFieldType(int i) {
 
-                       return table.Columns[i].DataType;
+                       DataRow row = table.Rows[i];
+                       return Type.GetType((string)row["DataType"]);
                }
 
                [MonoTODO]
@@ -251,24 +254,29 @@ namespace System.Data.SqlClient {
 
                [MonoTODO]
                public string GetName(int i) {
-                       return table.Columns[i].ColumnName;
+
+                       DataRow row = table.Rows[i];
+                       return (string) row["ColumnName"];
                }
 
                [MonoTODO]
                public int GetOrdinal(string name) {
+
                        int i;
-                       for(i = 0; i < cols; i ++) {
-                               if(table.Columns[i].ColumnName.Equals(name)) {
-                                       return i;
-                               }
+                       DataRow row;
 
+                       for(i = 0; i < table.Rows.Count; i++) {
+                               row = table.Rows[i];
+                               if(((string) row["ColumnName"]).Equals(name))
+                                       return i;
                        }
-       
-                       for(i = 0; i < cols; i++) {
+
+                       for(i = 0; i < table.Rows.Count; i++) {
                                string ta;
                                string n;
-                                               
-                               ta = table.Columns[i].ColumnName.ToUpper();
+                                       
+                               row = table.Rows[i];
+                               ta = ((string) row["ColumnName"]).ToUpper();
                                n = name.ToUpper();
                                                
                                if(ta.Equals(n)) {
@@ -319,9 +327,9 @@ namespace System.Data.SqlClient {
                public void Dispose () {
                }
 
-               [MonoTODO]
-               ~SqlDataReader() {
-               }
+               //[MonoTODO]
+               //~SqlDataReader() {
+               //}
 
                #endregion // Destructors
 
@@ -330,7 +338,9 @@ namespace System.Data.SqlClient {
                public int Depth {
                        [MonoTODO]
                        get { 
-                               throw new NotImplementedException (); 
+                               return 0; // always return zero, unless
+                                         // this provider will allow
+                                         // nesting of a row
                        }
                }
 
@@ -347,7 +357,7 @@ namespace System.Data.SqlClient {
                public int RecordsAffected {
                        [MonoTODO]
                        get { 
-                               throw new NotImplementedException (); 
+                               return recordsAffected;
                        }
                }
        
@@ -362,18 +372,20 @@ namespace System.Data.SqlClient {
                        [MonoTODO]
                        get { 
                                int i;
-                               for(i = 0; i < cols; i ++) {
-                                       if(table.Columns[i].ColumnName.Equals(name)) {
-                                               return fields[i];
-                                       }
+                               DataRow row;
 
+                               for(i = 0; i < table.Rows.Count; i++) {
+                                       row = table.Rows[i];
+                                       if(row["ColumnName"].Equals(name))
+                                               return fields[i];
                                }
-       
-                               for(i = 0; i < cols; i++) {
+
+                               for(i = 0; i < table.Rows.Count; i++) {
                                        string ta;
                                        string n;
-                                               
-                                       ta = table.Columns[i].ColumnName.ToUpper();
+                                       
+                                       row = table.Rows[i];
+                                       ta = ((string) row["ColumnName"]).ToUpper();
                                        n = name.ToUpper();
                                                
                                        if(ta.Equals(n)) {
index e2224476c2296f13f69f8a1c2da4bd650936bd1f..d68d57bfa37727688eafb7dc0f08491010b85de2 100644 (file)
@@ -719,7 +719,7 @@ namespace System.Data.SqlClient {
                        dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
                        dataTableSchema.Columns.Add ("DataType", typeof(string));
                        dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
-                       dataTableSchema.Columns.Add ("ProviderType", typeof (string));
+                       dataTableSchema.Columns.Add ("ProviderType", typeof (int));
                        dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
                        dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
                        dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
@@ -763,7 +763,7 @@ namespace System.Data.SqlClient {
                                schemaRow["DataType"] = st;\r
 
                                schemaRow["AllowDBNull"] = false; // ? tim
-                               schemaRow["ProviderType"] = ""; // ? tim
+                               schemaRow["ProviderType"] = oid; // ? tim
                                schemaRow["IsAliased"] = false; // ? tim
                                schemaRow["IsExpression"] = false; // ? tim
                                schemaRow["IsIdentity"] = false; // ? tim
index 802bc3f39632a3af6cf7e416dfa0b85b63530852..6d55d61673a820f32770d4c089b88670181b21ab 100644 (file)
@@ -56,6 +56,8 @@ namespace System.Data.SqlClient {
                private int rows;
                private int cols;
 
+               private int recordsAffected = -1; // TODO: get this value
+
                private int currentRow = -1; // no Read() has been done yet
 
                #endregion // Fields
@@ -221,7 +223,8 @@ namespace System.Data.SqlClient {
                [MonoTODO]
                public Type GetFieldType(int i) {
 
-                       return table.Columns[i].DataType;
+                       DataRow row = table.Rows[i];
+                       return Type.GetType((string)row["DataType"]);
                }
 
                [MonoTODO]
@@ -251,24 +254,29 @@ namespace System.Data.SqlClient {
 
                [MonoTODO]
                public string GetName(int i) {
-                       return table.Columns[i].ColumnName;
+
+                       DataRow row = table.Rows[i];
+                       return (string) row["ColumnName"];
                }
 
                [MonoTODO]
                public int GetOrdinal(string name) {
+
                        int i;
-                       for(i = 0; i < cols; i ++) {
-                               if(table.Columns[i].ColumnName.Equals(name)) {
-                                       return i;
-                               }
+                       DataRow row;
 
+                       for(i = 0; i < table.Rows.Count; i++) {
+                               row = table.Rows[i];
+                               if(((string) row["ColumnName"]).Equals(name))
+                                       return i;
                        }
-       
-                       for(i = 0; i < cols; i++) {
+
+                       for(i = 0; i < table.Rows.Count; i++) {
                                string ta;
                                string n;
-                                               
-                               ta = table.Columns[i].ColumnName.ToUpper();
+                                       
+                               row = table.Rows[i];
+                               ta = ((string) row["ColumnName"]).ToUpper();
                                n = name.ToUpper();
                                                
                                if(ta.Equals(n)) {
@@ -319,9 +327,9 @@ namespace System.Data.SqlClient {
                public void Dispose () {
                }
 
-               [MonoTODO]
-               ~SqlDataReader() {
-               }
+               //[MonoTODO]
+               //~SqlDataReader() {
+               //}
 
                #endregion // Destructors
 
@@ -330,7 +338,9 @@ namespace System.Data.SqlClient {
                public int Depth {
                        [MonoTODO]
                        get { 
-                               throw new NotImplementedException (); 
+                               return 0; // always return zero, unless
+                                         // this provider will allow
+                                         // nesting of a row
                        }
                }
 
@@ -347,7 +357,7 @@ namespace System.Data.SqlClient {
                public int RecordsAffected {
                        [MonoTODO]
                        get { 
-                               throw new NotImplementedException (); 
+                               return recordsAffected;
                        }
                }
        
@@ -362,18 +372,20 @@ namespace System.Data.SqlClient {
                        [MonoTODO]
                        get { 
                                int i;
-                               for(i = 0; i < cols; i ++) {
-                                       if(table.Columns[i].ColumnName.Equals(name)) {
-                                               return fields[i];
-                                       }
+                               DataRow row;
 
+                               for(i = 0; i < table.Rows.Count; i++) {
+                                       row = table.Rows[i];
+                                       if(row["ColumnName"].Equals(name))
+                                               return fields[i];
                                }
-       
-                               for(i = 0; i < cols; i++) {
+
+                               for(i = 0; i < table.Rows.Count; i++) {
                                        string ta;
                                        string n;
-                                               
-                                       ta = table.Columns[i].ColumnName.ToUpper();
+                                       
+                                       row = table.Rows[i];
+                                       ta = ((string) row["ColumnName"]).ToUpper();
                                        n = name.ToUpper();
                                                
                                        if(ta.Equals(n)) {
index e89262372b4c7b38edfd8ca6eef0207bd97f301d..5a3aae1c56b616a1c00419b97d0f737ed20f93ae 100644 (file)
@@ -1,3 +1,14 @@
+2002-05-23  Daniel Morgan <danmorg@sc.rr.com>
+
+       * System.Data.SqlClient/SqlCommand.cs: set
+       the "ProviderType" to the PostgreSQL type oid
+       
+       * System.Data.SqlClient/SqlDataReader.cs: fix
+       for various properties and methods that 
+       return meta data: Item indexers this[name] and this[index],
+       GetFieldType, GetName, and GetOrdinal.  SqlDataAdapter
+       should work again.
+
 2002-05-22  Daniel Morgan <danmorg@sc.rr.com>
 
        * System.Data/DataRow.cs: change suggested
index e2224476c2296f13f69f8a1c2da4bd650936bd1f..d68d57bfa37727688eafb7dc0f08491010b85de2 100644 (file)
@@ -719,7 +719,7 @@ namespace System.Data.SqlClient {
                        dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
                        dataTableSchema.Columns.Add ("DataType", typeof(string));
                        dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
-                       dataTableSchema.Columns.Add ("ProviderType", typeof (string));
+                       dataTableSchema.Columns.Add ("ProviderType", typeof (int));
                        dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
                        dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
                        dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
@@ -763,7 +763,7 @@ namespace System.Data.SqlClient {
                                schemaRow["DataType"] = st;\r
 
                                schemaRow["AllowDBNull"] = false; // ? tim
-                               schemaRow["ProviderType"] = ""; // ? tim
+                               schemaRow["ProviderType"] = oid; // ? tim
                                schemaRow["IsAliased"] = false; // ? tim
                                schemaRow["IsExpression"] = false; // ? tim
                                schemaRow["IsIdentity"] = false; // ? tim
index 802bc3f39632a3af6cf7e416dfa0b85b63530852..6d55d61673a820f32770d4c089b88670181b21ab 100644 (file)
@@ -56,6 +56,8 @@ namespace System.Data.SqlClient {
                private int rows;
                private int cols;
 
+               private int recordsAffected = -1; // TODO: get this value
+
                private int currentRow = -1; // no Read() has been done yet
 
                #endregion // Fields
@@ -221,7 +223,8 @@ namespace System.Data.SqlClient {
                [MonoTODO]
                public Type GetFieldType(int i) {
 
-                       return table.Columns[i].DataType;
+                       DataRow row = table.Rows[i];
+                       return Type.GetType((string)row["DataType"]);
                }
 
                [MonoTODO]
@@ -251,24 +254,29 @@ namespace System.Data.SqlClient {
 
                [MonoTODO]
                public string GetName(int i) {
-                       return table.Columns[i].ColumnName;
+
+                       DataRow row = table.Rows[i];
+                       return (string) row["ColumnName"];
                }
 
                [MonoTODO]
                public int GetOrdinal(string name) {
+
                        int i;
-                       for(i = 0; i < cols; i ++) {
-                               if(table.Columns[i].ColumnName.Equals(name)) {
-                                       return i;
-                               }
+                       DataRow row;
 
+                       for(i = 0; i < table.Rows.Count; i++) {
+                               row = table.Rows[i];
+                               if(((string) row["ColumnName"]).Equals(name))
+                                       return i;
                        }
-       
-                       for(i = 0; i < cols; i++) {
+
+                       for(i = 0; i < table.Rows.Count; i++) {
                                string ta;
                                string n;
-                                               
-                               ta = table.Columns[i].ColumnName.ToUpper();
+                                       
+                               row = table.Rows[i];
+                               ta = ((string) row["ColumnName"]).ToUpper();
                                n = name.ToUpper();
                                                
                                if(ta.Equals(n)) {
@@ -319,9 +327,9 @@ namespace System.Data.SqlClient {
                public void Dispose () {
                }
 
-               [MonoTODO]
-               ~SqlDataReader() {
-               }
+               //[MonoTODO]
+               //~SqlDataReader() {
+               //}
 
                #endregion // Destructors
 
@@ -330,7 +338,9 @@ namespace System.Data.SqlClient {
                public int Depth {
                        [MonoTODO]
                        get { 
-                               throw new NotImplementedException (); 
+                               return 0; // always return zero, unless
+                                         // this provider will allow
+                                         // nesting of a row
                        }
                }
 
@@ -347,7 +357,7 @@ namespace System.Data.SqlClient {
                public int RecordsAffected {
                        [MonoTODO]
                        get { 
-                               throw new NotImplementedException (); 
+                               return recordsAffected;
                        }
                }
        
@@ -362,18 +372,20 @@ namespace System.Data.SqlClient {
                        [MonoTODO]
                        get { 
                                int i;
-                               for(i = 0; i < cols; i ++) {
-                                       if(table.Columns[i].ColumnName.Equals(name)) {
-                                               return fields[i];
-                                       }
+                               DataRow row;
 
+                               for(i = 0; i < table.Rows.Count; i++) {
+                                       row = table.Rows[i];
+                                       if(row["ColumnName"].Equals(name))
+                                               return fields[i];
                                }
-       
-                               for(i = 0; i < cols; i++) {
+
+                               for(i = 0; i < table.Rows.Count; i++) {
                                        string ta;
                                        string n;
-                                               
-                                       ta = table.Columns[i].ColumnName.ToUpper();
+                                       
+                                       row = table.Rows[i];
+                                       ta = ((string) row["ColumnName"]).ToUpper();
                                        n = name.ToUpper();
                                                
                                        if(ta.Equals(n)) {