Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Remove unused locals in System.Data.OleDb (#42485)
Browse files Browse the repository at this point in the history
* emove unused locals in System.Data.OleDband keep some logic using discard. Partially fix issue #39962

* Update src/System.Data.OleDb/src/OleDbDataReader.cs

update as suggested (OleDbDataReader)

Co-Authored-By: Stephen Toub <[email protected]>

* Update src/System.Data.OleDb/src/OleDbTransaction.cs

Done update as suggested

Co-Authored-By: Stephen Toub <[email protected]>

* Update src/System.Data.OleDb/src/RowBinding.cs

Done update as suggested (RowDataBinding)

Co-Authored-By: Stephen Toub <[email protected]>

* Update src/System.Data.OleDb/src/RowBinding.cs

Done as suggested

Co-Authored-By: Stephen Toub <[email protected]>

* Update src/System.Data.OleDb/src/SafeHandles.cs

Done updating as suggested (SafeHandles)

Co-Authored-By: Stephen Toub <[email protected]>
  • Loading branch information
2 people authored and msftbot[bot] committed Nov 13, 2019
1 parent 8a6b808 commit eceea8b
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 23 deletions.
6 changes: 0 additions & 6 deletions src/System.Data.OleDb/src/OleDbConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,6 @@ internal void OnInfoMessage(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResu
ADP.TraceExceptionWithoutRethrow(e);
}
}
#if DEBUG
else
{
OleDbException exception = OleDbException.CreateException(errorInfo, errorCode, null);
}
#endif
}

public override void Open()
Expand Down
3 changes: 0 additions & 3 deletions src/System.Data.OleDb/src/OleDbConnectionInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ public override void Dispose()

public override void EnlistTransaction(SysTx.Transaction transaction)
{
OleDbConnection outerConnection = Connection;
if (null != LocalTransaction)
{
throw ADP.LocalTransactionPresent();
Expand Down Expand Up @@ -821,8 +820,6 @@ internal OleDbTransaction ValidateTransaction(OleDbTransaction transaction, stri

internal Dictionary<string, OleDbPropertyInfo> GetPropertyInfo(Guid[] propertySets)
{
bool isopen = HasSession;
OleDbConnectionString constr = ConnectionString;
Dictionary<string, OleDbPropertyInfo> properties = null;

if (null == propertySets)
Expand Down
8 changes: 0 additions & 8 deletions src/System.Data.OleDb/src/OleDbDataAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@ record = (adodb as UnsafeNativeMethods.ADORecordConstruction);
UnsafeNativeMethods.GetErrorInfo(0, out errorInfo);

string message = string.Empty;
if (null != errorInfo)
{
OleDbHResult hresult = ODB.GetErrorDescription(errorInfo, hr, out message);
}
throw new COMException(message, (int)hr);
}
break;
Expand Down Expand Up @@ -436,10 +432,6 @@ private void FillClose(bool isrecordset, object value)
UnsafeNativeMethods.IErrorInfo errorInfo = null;
UnsafeNativeMethods.GetErrorInfo(0, out errorInfo);
string message = string.Empty;
if (null != errorInfo)
{
OleDbHResult hresult = ODB.GetErrorDescription(errorInfo, hr, out message);
}
throw new COMException(message, (int)hr);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/System.Data.OleDb/src/OleDbDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ public override int GetValues(object[] values)
{
throw ADP.ArgumentNull("values");
}
MetaData info = DoValueCheck(0);
DoValueCheck(0);
int count = Math.Min(values.Length, _visibleFieldCount);
for (int i = 0; (i < _metadata.Length) && (i < count); ++i)
{
Expand Down Expand Up @@ -2163,7 +2163,6 @@ private void AppendSchemaUniqueIndexAsKey(Hashtable baseColumnNames, object[] re
{
bool isPKey = (!dataRow.IsNull(pkeyColumn, DataRowVersion.Default) && (bool)dataRow[pkeyColumn, DataRowVersion.Default]);
bool isUniq = (!dataRow.IsNull(uniqCOlumn, DataRowVersion.Default) && (bool)dataRow[uniqCOlumn, DataRowVersion.Default]);
bool nullsVal = (null != nulls) && (dataRow.IsNull(nulls, DataRowVersion.Default) || (ODB.DBPROPVAL_IN_ALLOWNULL == Convert.ToInt32(dataRow[nulls, DataRowVersion.Default], CultureInfo.InvariantCulture)));

if (isPKey || isUniq)
{
Expand Down
2 changes: 1 addition & 1 deletion src/System.Data.OleDb/src/OleDbTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected override bool ReleaseHandle()
{
if (_mustComplete && (IntPtr.Zero != base.handle))
{
OleDbHResult hr = (OleDbHResult)NativeOledbWrapper.ITransactionAbort(base.handle);
NativeOledbWrapper.ITransactionAbort(base.handle);
_mustComplete = false;
}
return base.ReleaseHandle();
Expand Down
3 changes: 1 addition & 2 deletions src/System.Data.OleDb/src/RowBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,7 @@ private static void FreeChapter(IntPtr buffer, int valueOffset, object iaccessor
IntPtr chapter = SafeNativeMethods.InterlockedExchangePointer(ADP.IntPtrOffset(buffer, valueOffset), ADP.PtrZero);
if (ODB.DB_NULL_HCHAPTER != chapter)
{
int refCount;
OleDbHResult hr = chapteredRowset.ReleaseChapter(chapter, out refCount);
chapteredRowset.ReleaseChapter(chapter, out _);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/System.Data.OleDb/src/SafeHandles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected override bool ReleaseHandle()

if ((IntPtr.Zero != base.handle) && (IntPtr.Zero != chapter))
{
OleDbHResult hr = (OleDbHResult)NativeOledbWrapper.IChapteredRowsetReleaseChapter(base.handle, chapter);
NativeOledbWrapper.IChapteredRowsetReleaseChapter(base.handle, chapter);
}
return base.ReleaseHandle();
}
Expand Down

0 comments on commit eceea8b

Please sign in to comment.