Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@@ -50,11 +50,6 @@ namespace System.Data.Common
return caught;
}
}
internal static void TraceExceptionWithoutRethrow(Exception e)
{
Debug.Assert(ADP.IsCatchableExceptionType(e), "Invalid exception type, should have been re-thrown!");
TraceException("<comm.ADP.TraceException|ERR|CATCH> '%ls'\n", e);
}
//
// COM+ exceptions
@@ -576,11 +571,6 @@ namespace System.Data.Common
internal static readonly IntPtr PtrZero = new IntPtr(0); // IntPtr.Zero
internal static readonly int PtrSize = IntPtr.Size;
internal static bool CompareInsensitiveInvariant(string strvalue, string strconst)
{
return (0 == CultureInfo.InvariantCulture.CompareInfo.Compare(strvalue, strconst, CompareOptions.IgnoreCase));
}
internal static Delegate FindBuilder(MulticastDelegate mcd)
{ // V1.2.3300
if (null != mcd)
@@ -677,10 +667,5 @@ namespace System.Data.Common
Debug.Assert(8 == ADP.PtrSize, "8 != IntPtr.Size"); // MDAC 73747
return (IntPtr)checked(pbase.ToInt64() + offset);
}
internal static bool IsEmptyArray(string[] array)
{
return ((null == array) || (0 == array.Length));
}
}
}

View File

@@ -28,7 +28,7 @@ namespace System.Data.Common
private readonly string _encryptedUsersConnectionString;
// hash of unique keys to values
private readonly Hashtable _parsetable;
private readonly Dictionary<string, string> _parsetable;
// a linked list of key/value and their length in _encryptedUsersConnectionString
private readonly NameValuePair _keychain;
@@ -48,7 +48,7 @@ namespace System.Data.Common
private readonly string _encryptedActualConnectionString;
#pragma warning restore 169
internal DBConnectionString(string value, string restrictions, KeyRestrictionBehavior behavior, Hashtable synonyms, bool useOdbcRules)
internal DBConnectionString(string value, string restrictions, KeyRestrictionBehavior behavior, Dictionary<string, string> synonyms, bool useOdbcRules)
: this(new DbConnectionOptions(value, synonyms, useOdbcRules), restrictions, behavior, synonyms, false)
{
// useOdbcRules is only used to parse the connection string, not to parse restrictions because values don't apply there
@@ -56,13 +56,13 @@ namespace System.Data.Common
}
internal DBConnectionString(DbConnectionOptions connectionOptions)
: this(connectionOptions, (string)null, KeyRestrictionBehavior.AllowOnly, (Hashtable)null, true)
: this(connectionOptions, (string)null, KeyRestrictionBehavior.AllowOnly, null, true)
{
// used by DBDataPermission to convert from DbConnectionOptions to DBConnectionString
// since backward compatability requires Everett level classes
}
private DBConnectionString(DbConnectionOptions connectionOptions, string restrictions, KeyRestrictionBehavior behavior, Hashtable synonyms, bool mustCloneDictionary)
private DBConnectionString(DbConnectionOptions connectionOptions, string restrictions, KeyRestrictionBehavior behavior, Dictionary<string, string> synonyms, bool mustCloneDictionary)
{ // used by DBDataPermission
Debug.Assert(null != connectionOptions, "null connectionOptions");
switch (behavior)
@@ -77,9 +77,9 @@ namespace System.Data.Common
// grab all the parsed details from DbConnectionOptions
_encryptedUsersConnectionString = connectionOptions.UsersConnectionString(false);
_hasPassword = connectionOptions.HasPasswordKeyword;
_hasPassword = connectionOptions._hasPasswordKeyword;
_parsetable = connectionOptions.Parsetable;
_keychain = connectionOptions.KeyChain;
_keychain = connectionOptions._keyChain;
// we do not want to serialize out user password unless directed so by "persist security info=true"
// otherwise all instances of user's password will be replaced with "*"
@@ -89,7 +89,7 @@ namespace System.Data.Common
{
// clone the hashtable to replace user's password/pwd value with "*"
// we only need to clone if coming from DbConnectionOptions and password exists
_parsetable = (Hashtable)_parsetable.Clone();
_parsetable = new Dictionary<string, string>(_parsetable);
}
// different than Everett in that instead of removing password/pwd from
@@ -462,7 +462,7 @@ namespace System.Data.Common
return restrictionValues;
}
private static string[] ParseRestrictions(string restrictions, Hashtable synonyms)
private static string[] ParseRestrictions(string restrictions, Dictionary<string, string> synonyms)
{
List<string> restrictionValues = new List<string>();
StringBuilder buffer = new StringBuilder(restrictions.Length);

View File

@@ -1,130 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Data.Common
{
[Serializable()]
internal sealed class ReadOnlyCollection<T> : System.Collections.ICollection, ICollection<T>
{
private T[] _items;
internal ReadOnlyCollection(T[] items)
{
_items = items;
#if DEBUG
for (int i = 0; i < items.Length; ++i)
{
Debug.Assert(null != items[i], "null item");
}
#endif
}
public void CopyTo(T[] array, int arrayIndex)
{
Array.Copy(_items, 0, array, arrayIndex, _items.Length);
}
void System.Collections.ICollection.CopyTo(Array array, int arrayIndex)
{
Array.Copy(_items, 0, array, arrayIndex, _items.Length);
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator<T>(_items);
}
public System.Collections.IEnumerator GetEnumerator()
{
return new Enumerator<T>(_items);
}
bool System.Collections.ICollection.IsSynchronized
{
get { return false; }
}
Object System.Collections.ICollection.SyncRoot
{
get { return _items; }
}
bool ICollection<T>.IsReadOnly
{
get { return true; }
}
void ICollection<T>.Add(T value)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T value)
{
return Array.IndexOf(_items, value) >= 0;
}
bool ICollection<T>.Remove(T value)
{
throw new NotSupportedException();
}
public int Count
{
get { return _items.Length; }
}
[Serializable()]
internal struct Enumerator<K> : IEnumerator<K>, System.Collections.IEnumerator
{ // based on List<T>.Enumerator
private K[] _items;
private int _index;
internal Enumerator(K[] items)
{
_items = items;
_index = -1;
}
public void Dispose()
{
}
public bool MoveNext()
{
return (++_index < _items.Length);
}
public K Current
{
get
{
return _items[_index];
}
}
Object System.Collections.IEnumerator.Current
{
get
{
return _items[_index];
}
}
void System.Collections.IEnumerator.Reset()
{
_index = -1;
}
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Runtime.InteropServices;
namespace System.Data.Common
namespace System.Data
{
internal class SafeNativeMethods
internal partial class SafeNativeMethods
{
internal static IntPtr LocalAlloc(IntPtr initialSize)
{

View File

@@ -21,6 +21,9 @@
</Compile>
<Compile Include="Common\System\Data\Common\AdapterUtil.Odbc.cs" />
<Compile Include="Common\System\Data\Common\DbConnectionOptions.cs" />
<Compile Include="$(CommonPath)\System\Data\Common\DbConnectionOptions.Common.cs">
<Link>Common\System\Data\Common\DbConnectionOptions.Common.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Data\Common\DbConnectionPoolKey.cs">
<Link>System\Data\Common\DbConnectionPoolKey.cs</Link>
</Compile>
@@ -104,7 +107,6 @@
<Compile Include="$(CommonPath)\System\Data\Common\MultipartIdentifier.cs">
<Link>Common\System\Data\Common\MultipartIdentifier.cs</Link>
</Compile>
<Compile Include="Common\System\Data\Common\ReadOnlyCollection.cs" />
<Compile Include="Common\System\Data\Common\UnsafeNativeMethods.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' And '$(IsPartialFacadeAssembly)' != 'true' ">

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Common;
@@ -192,7 +193,7 @@ namespace System.Data.Odbc
}
_knownKeywords = knownKeywords;
}
return new System.Data.Common.ReadOnlyCollection<string>(knownKeywords);
return new ReadOnlyCollection<string>(knownKeywords);
}
}

View File

@@ -6,7 +6,7 @@ using System.Data.Common;
namespace System.Data.Odbc
{
public sealed class OdbcFactory : DbProviderFactory
public sealed partial class OdbcFactory : DbProviderFactory
{
public static readonly OdbcFactory Instance = new OdbcFactory();