Skip to content

Commit

Permalink
Remove unused locals in System.Data.Common and keep some logic using …
Browse files Browse the repository at this point in the history
…discard (dotnet/corefx#41962)

* 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 dotnet/corefx@ae71c86
  • Loading branch information
eriawan authored and stephentoub committed Oct 23, 2019
1 parent 5cb3dca commit 322d208
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,6 @@ private void OnCollectionChanged(CollectionChangeEventArgs ccevent)
{
_table.UpdatePropertyDescriptorCollectionCache();

if ((null != ccevent) && !_table.SchemaLoading && !_table.fInitInProgress)
{
DataColumn column = (DataColumn)ccevent.Element;
}

CollectionChanged?.Invoke(this, ccevent);
}

Expand Down
5 changes: 2 additions & 3 deletions src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,8 @@ public void LoadSchema(XmlSchemaSet schemaSet, DataSet ds)
continue;
}

DataTable table = HandleTable(element);
_ = HandleTable(element);

}

if (_dsElement != null)
Expand Down Expand Up @@ -2364,7 +2365,6 @@ internal void HandleElementColumn(XmlSchemaElement elem, DataTable table, bool i
// 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);
}
Expand Down Expand Up @@ -2536,7 +2536,6 @@ internal void HandleDataSet(XmlSchemaElement node, bool isNewDataSet)
{
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>();

Expand Down
10 changes: 2 additions & 8 deletions src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ internal XmlElement SchemaTree(XmlDocument xd, DataTable dt)
_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);
Expand Down Expand Up @@ -1493,8 +1493,7 @@ internal XmlElement HandleColumn(DataColumn col, XmlDocument dc, XmlElement sche
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);
}
}
}
Expand Down Expand Up @@ -2486,9 +2485,6 @@ private void GenerateRow(DataRow row)

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);

Expand Down Expand Up @@ -2774,8 +2770,6 @@ internal void SaveDiffgramData(XmlWriter xw, Hashtable rowsOrder)
_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)
Expand Down

0 comments on commit 322d208

Please sign in to comment.