Remove unused locals in System.Data.Common and keep some logic using discard (dotnet...
authorEriawan Kusumawardhono <eriawan@live.com>
Wed, 23 Oct 2019 13:33:22 +0000 (20:33 +0700)
committerStephen Toub <stoub@microsoft.com>
Wed, 23 Oct 2019 13:33:22 +0000 (09:33 -0400)
* remove unused locals in System.Data.Common and keep some logic using discard

* revert the HandleTable(element) removal as PR feedback. Use discard as return value is ignored.

Commit migrated from https://github.com/dotnet/corefx/commit/ae71c86289d759318e212144b94c58d0a586a33c

src/libraries/System.Data.Common/src/System/Data/DataColumnCollection.cs
src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs

index 7598e2c..014ad8b 100644 (file)
@@ -802,11 +802,6 @@ namespace System.Data
         {
             _table.UpdatePropertyDescriptorCollectionCache();
 
-            if ((null != ccevent) && !_table.SchemaLoading && !_table.fInitInProgress)
-            {
-                DataColumn column = (DataColumn)ccevent.Element;
-            }
-
             CollectionChanged?.Invoke(this, ccevent);
         }
 
index e88572c..726c377 100644 (file)
@@ -783,7 +783,8 @@ namespace System.Data
                     continue;
                 }
 
-                DataTable table = HandleTable(element);
+                _ = HandleTable(element);
+
             }
 
             if (_dsElement != null)
@@ -2364,7 +2365,6 @@ namespace System.Data
                 // it should be  user defined  Named  simple type
                 if (((XmlSchemaSimpleType)typeNode).Name != null && ((XmlSchemaSimpleType)typeNode).Name.Length != 0 && ((XmlSchemaSimpleType)typeNode).QualifiedName.Namespace != Keywords.XSDNS)
                 {
-                    string targetNamespace = XSDSchema.GetMsdataAttribute(typeNode, Keywords.TARGETNAMESPACE);
                     strType = ((XmlSchemaSimpleType)typeNode).QualifiedName.ToString(); // use qualifed name
                     type = ParseDataType(strType);
                 }
@@ -2536,7 +2536,6 @@ namespace System.Data
         {
             string dsName = node.Name;
             string dsNamespace = node.QualifiedName.Namespace;
-            int initialTableCount = _ds.Tables.Count; // just use for inference backward compatablity
 
             List<DataTable> tableSequenceList = new List<DataTable>();
 
index 59c8672..c8cee2a 100644 (file)
@@ -949,7 +949,7 @@ namespace System.Data
             _sRoot = rootSchema;
             WriteSchemaRoot(xd, rootSchema, dt.Namespace);
 
-            XmlElement dsCompositor = FillDataSetElement(xd, null, dt);
+            _ = FillDataSetElement(xd, null, dt);
 
             _constraintSeparator = xd.CreateElement(Keywords.XSD_PREFIX, "SHOULDNOTBEHERE", Keywords.XSDNS);
             _dsElement.AppendChild(_constraintSeparator);
@@ -1493,8 +1493,7 @@ namespace System.Data
                     root.SetAttribute(Keywords.REF, _prefixes[col.Namespace] + ":" + col.EncodedColumnName);
                     if (col.Table.Namespace != _ds.Namespace)
                     {
-                        string prefix = (string)_prefixes[col.Namespace];
-                        XmlElement tNode = GetSchema(col.Table.Namespace);
+                        _ = GetSchema(col.Table.Namespace);
                     }
                 }
             }
@@ -2486,9 +2485,6 @@ namespace System.Data
 
             string tablePrefix = (table.Namespace.Length != 0) ? table.Prefix : string.Empty;
 
-            // read value if the TextOnly column (if any)
-            object val = (table.XmlText == null ? DBNull.Value : row[table.XmlText, DataRowVersion.Original]);
-
             //old row
             _xmlw.WriteStartElement(tablePrefix, row.Table.EncodedTableName, row.Table.Namespace);
 
@@ -2774,8 +2770,6 @@ namespace System.Data
             _isDiffgram = true;
             _rowsOrder = rowsOrder;
 
-            int countTopTable = _topLevelTables.Length;
-
             string prefix = (_ds != null) ? ((_ds.Namespace.Length == 0) ? "" : _ds.Prefix) : ((_dt.Namespace.Length == 0) ? "" : _dt.Prefix);
 
             if (_ds == null || _ds.DataSetName == null || _ds.DataSetName.Length == 0)