2004-12-10 Sureshkumar T <tsureshkumar@novell.com>
authorSureshkumar T <suresh@mono-cvs.ximian.com>
Fri, 10 Dec 2004 13:39:28 +0000 (13:39 -0000)
committerSureshkumar T <suresh@mono-cvs.ximian.com>
Fri, 10 Dec 2004 13:39:28 +0000 (13:39 -0000)
* DbDataAdapter.cs (BuildSchema): Add the primary key schema iff
MissingSchemaAction is set to AddWithKey. Also, Add auto increment
value from the source table. fixes bug #67757 and #69110.

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

mcs/class/System.Data/System.Data.Common/ChangeLog
mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs

index 8e9b8d55692c64b174fcbb9d8ed71f3f6c3ff9de..22b4392b1a14117e268ccf34f70a41620776886a 100755 (executable)
@@ -1,3 +1,9 @@
+2004-12-10  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * DbDataAdapter.cs (BuildSchema): Add the primary key schema iff
+       MissingSchemaAction is set to AddWithKey. Also, Add auto increment
+       value from the source table. fixes bug #67757 and #69110.
+
 2004-11-24  Sureshkumar T  <tsureshkumar@novell.com>
 
        * DbProviderSupportedClasses.cs: Added correct enum values.
index 79c5b8198f3ffb38ad2aa5a2eae3c2d93b537a4d..79ee2405295806988709fdca6ed2d268f9a49f3f 100644 (file)
@@ -536,13 +536,19 @@ namespace System.Data.Common {
                                                        // if the column is not in the table - add it.
                                                        if (table.Columns.IndexOf(col) == -1)
                                                        {
-                                                               if (MissingSchemaAction == MissingSchemaAction.Add || MissingSchemaAction == MissingSchemaAction.AddWithKey)
+                                                               if (MissingSchemaAction == MissingSchemaAction.Add 
+                                                                    || MissingSchemaAction == MissingSchemaAction.AddWithKey)
                                                                        table.Columns.Add(col);
                                                        }
 
-                                                       if (!schemaRow["IsKey"].Equals (DBNull.Value))
-                                                               if ((bool) (schemaRow ["IsKey"]))
-                                                                       primaryKey.Add (col);
+
+                                                        if (MissingSchemaAction == MissingSchemaAction.AddWithKey) {
+                                                                if (!schemaRow["IsKey"].Equals (DBNull.Value))
+                                                                        if ((bool) (schemaRow ["IsKey"]))
+                                                                                primaryKey.Add (col);
+                                                                
+                                                                col.AutoIncrement = (bool) schemaRow ["IsAutoIncrement"];
+                                                        }
                                                        
                                                        // add the ordinal of the column as a key and the index of the column in the datareader as a value.
                                                        mapping[col.Ordinal] = readerIndex;