Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -1,63 +0,0 @@
//
// System.Data.SqlClient.NetworkLibraryConverter.cs
//
// Author:
// Nagappan A (anagappan@novell.com)
//
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Globalization;
namespace System.Data.SqlClient {
internal sealed class NetworkLibraryConverter : ExpandableObjectConverter
{
#region Constructors
[MonoTODO]
public NetworkLibraryConverter ()
{
throw new NotImplementedException ();
}
#endregion // Constructors
#region Methods
[MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
throw new NotImplementedException ();
}
#endregion // Methods
}
}

View File

@@ -1,36 +0,0 @@
//
// System.Data.SqlClient.OnChangeEventHandler.cs
//
// Author:
// Umadevi S (sumadevi@novell.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Data.SqlClient {
public delegate void OnChangeEventHandler(object sender, SqlNotificationEventArgs e);
}

View File

@@ -1,40 +0,0 @@
//
// System.Data.SqlClient.SortOrder.cs
//
// Author:
// Jonathan Pobst (monkey@jpobst.com)
//
//
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Data.SqlClient
{
public enum SortOrder
{
Ascending = 0,
Descending = 1,
Unspecified = -1
}
}

View File

@@ -1,137 +0,0 @@
//
// System.Data.SqlClient.SqlAsyncResult.cs
//
// Author:
// T Sureshkumar <tsureshkumar@novell.com>
// Ankit Jain <radical@corewars.org>
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Threading;
namespace System.Data.SqlClient
{
internal class SqlAsyncResult : IAsyncResult
{
private SqlAsyncState _sqlState;
private WaitHandle _waitHandle;
private bool _completed = false;
private bool _completedSyncly = false;
private bool _ended = false;
private AsyncCallback _userCallback = null;
private object _retValue;
private string _endMethod;
private IAsyncResult _internal;
public SqlAsyncResult (AsyncCallback userCallback, SqlAsyncState sqlState)
{
_sqlState = sqlState;
_userCallback = userCallback;
_waitHandle = new ManualResetEvent (false);
}
public SqlAsyncResult (AsyncCallback userCallback, object state)
{
_sqlState = new SqlAsyncState (state);
_userCallback = userCallback;
_waitHandle = new ManualResetEvent (false);
}
public object AsyncState
{
get { return _sqlState.UserState; }
}
internal SqlAsyncState SqlAsyncState
{
get { return _sqlState; }
}
public WaitHandle AsyncWaitHandle
{
get { return _waitHandle; }
}
public bool IsCompleted
{
get { return _completed; }
}
public bool CompletedSynchronously
{
get { return _completedSyncly; }
}
internal object ReturnValue
{
get { return _retValue; }
set { _retValue = value; }
}
public string EndMethod
{
get { return _endMethod; }
set { _endMethod = value; }
}
public bool Ended
{
get { return _ended; }
set { _ended = value; }
}
internal IAsyncResult InternalResult
{
get { return _internal; }
set { _internal = value; }
}
public AsyncCallback BubbleCallback
{
get { return new AsyncCallback (Bubbleback); }
}
internal void MarkComplete ()
{
_completed = true;
((ManualResetEvent)_waitHandle).Set ();
if (_userCallback != null)
_userCallback (this);
}
public void Bubbleback (IAsyncResult ar)
{
this.MarkComplete ();
}
}
}

View File

@@ -1,54 +0,0 @@
//
// System.Data.SqlClient.SqlAsyncState.cs
//
// Author:
// T Sureshkumar <tsureshkumar@novell.com>
// Ankit Jain <radical@corewars.org>
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Net.Sockets;
namespace System.Data.SqlClient
{
internal class SqlAsyncState
{
object _userState;
public SqlAsyncState (object userState)
{
_userState = userState;
}
public object UserState
{
get {return _userState;}
set {_userState = value;}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,176 +1,161 @@
//
// SqlBulkCopy.cs
//
// Author:
// Rolf Bjarne Kvinge <rolf@xamarin.com>
//
// Copyright (c) 2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// 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;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
namespace System.Data.SqlClient {
namespace System.Data.SqlClient
{
public sealed class SqlBulkCopy : IDisposable
{
const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlBulkCopy is not supported on the current platform.";
public SqlBulkCopy (SqlConnection connection)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlBulkCopy(SqlConnection connection)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlBulkCopy (string connectionString)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlBulkCopy(SqlConnection connection, SqlBulkCopyOptions copyOptions, SqlTransaction externalTransaction)
: this(connection)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlBulkCopy (string connectionString, SqlBulkCopyOptions copyOptions)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlBulkCopy(string connectionString) : this(new SqlConnection(connectionString))
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlBulkCopy (SqlConnection connection, SqlBulkCopyOptions copyOptions, SqlTransaction externalTransaction)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlBulkCopy(string connectionString, SqlBulkCopyOptions copyOptions)
: this(connectionString)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public int BatchSize {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public int BulkCopyTimeout {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public SqlBulkCopyColumnMappingCollection ColumnMappings {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public string DestinationTableName {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public bool EnableStreaming {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlBulkCopyColumnMappingCollection ColumnMappings
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public string DestinationTableName {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public int NotifyAfter {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public void Close ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public void WriteToServer (DataRow [] rows)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public void WriteToServer (DataTable table)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public void WriteToServer (IDataReader reader)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public void WriteToServer (DataTable table, DataRowState rowState)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public void WriteToServer (DbDataReader reader)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DataRow[] rows)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DataRow[] rows, CancellationToken cancellationToken)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (IDataReader reader)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (IDataReader reader, CancellationToken cancellationToken)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DbDataReader reader)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DbDataReader reader, CancellationToken cancellationToken)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DataTable table)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DataTable table, CancellationToken cancellationToken)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DataTable table, DataRowState rowState)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public Task WriteToServerAsync (DataTable table, DataRowState rowState, CancellationToken cancellationToken)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
private void RowsCopied (long rowsCopied)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public event SqlRowsCopiedEventHandler SqlRowsCopied;
void IDisposable.Dispose ()
{
internal SqlStatistics Statistics
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
void IDisposable.Dispose() {}
public void Close()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public void WriteToServer(DbDataReader reader)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public void WriteToServer(IDataReader reader)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public void WriteToServer(DataTable table)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public void WriteToServer(DataTable table, DataRowState rowState)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public void WriteToServer(DataRow[] rows)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DataRow[] rows)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DataRow[] rows, CancellationToken cancellationToken)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DbDataReader reader)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DbDataReader reader, CancellationToken cancellationToken)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(IDataReader reader)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(IDataReader reader, CancellationToken cancellationToken)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DataTable table)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DataTable table, CancellationToken cancellationToken)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DataTable table, DataRowState rowState)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Task WriteToServerAsync(DataTable table, DataRowState rowState, CancellationToken cancellationToken)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void OnConnectionClosed()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
#if DEBUG
internal static bool _setAlwaysTaskOnWrite = false;
internal static bool SetAlwaysTaskOnWrite {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
#endif
}
internal sealed class _ColumnMapping
{
internal int _sourceColumnOrdinal;
internal _SqlMetaData _metadata;
internal _ColumnMapping(int columnId, _SqlMetaData metadata) {}
}
internal sealed class Row
{
internal Row(int rowCount) {}
internal object[] DataFields => null;
internal object this[int index] => null;
}
internal sealed class Result
{
internal Result(_SqlMetaDataSet metadata) {}
internal int Count => 0;
internal _SqlMetaDataSet MetaData => null;
internal Row this[int index] => null;
internal void AddRow(Row row) {}
}
internal sealed class BulkCopySimpleResultSet
{
internal BulkCopySimpleResultSet() {}
internal Result this[int idx] => null;
internal void SetMetaData(_SqlMetaDataSet metadata) {}
internal int[] CreateIndexMap() => null;
internal object[] CreateRowBuffer() => null;
}
}

View File

@@ -1,136 +0,0 @@
//
// System.Data.SqlClient.SqlBulkCopyColumnMapping.cs
//
// Author:
// Umadevi S <sumadevi@novell.com>
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Data.SqlClient
{
/// <summary>
/// Class that defines the mapping between a column in the destination table and an
/// column in the datasource of SqlBulkCopy's instance
/// </summary>
public sealed class SqlBulkCopyColumnMapping {
#region Fields
int sourceOrdinal = -1;
int destinationOrdinal = -1;
string sourceColumn = null;
string destinationColumn = null;
#endregion //Fields
#region Constructors
public SqlBulkCopyColumnMapping() {
}
public SqlBulkCopyColumnMapping(int sourceColumnOrdinal, int destinationOrdinal){
SourceOrdinal = sourceColumnOrdinal;
DestinationOrdinal = destinationOrdinal;
}
public SqlBulkCopyColumnMapping(int sourceColumnOrdinal, string destinationColumn){
SourceOrdinal = sourceColumnOrdinal;
DestinationColumn = destinationColumn;
}
public SqlBulkCopyColumnMapping(string sourceColumn, int destinationOrdinal){
SourceColumn = sourceColumn;
DestinationOrdinal = destinationOrdinal;
}
public SqlBulkCopyColumnMapping(string sourceColumn, string destinationColumn){
SourceColumn = sourceColumn;
DestinationColumn = destinationColumn;
}
# endregion //Constructors
# region Properties
public String DestinationColumn {
get {
if (this.destinationColumn != null)
return destinationColumn;
else
return string.Empty; //ms:doesnot return null.
}
set {
// ms: whenever the name is set the ordinal is reset to -1
this.destinationOrdinal = -1;
this.destinationColumn = value;
}
}
public String SourceColumn {
get {
if (this.sourceColumn != null)
return sourceColumn;
else
return string.Empty;//ms doesnot return null
}
set {
// ms: whenever the name is set the ordinal is reset to -1
this.sourceOrdinal = -1;
this.sourceColumn = value;
}
}
public int DestinationOrdinal {
get {
return this.destinationOrdinal;
}
set {
// ms: whenever the ordinal is set, the name is null
if (value < 0)
throw new IndexOutOfRangeException ();
this.destinationColumn = null;
this.destinationOrdinal = value;
}
}
public int SourceOrdinal {
get {
return this.sourceOrdinal;
}
set {
// ms: whenever the ordinal is set, the name is null
if (value < 0)
throw new IndexOutOfRangeException ();
this.sourceColumn = null;
this.sourceOrdinal = value;
}
}
#endregion //Properties
}
}

View File

@@ -1,148 +0,0 @@
//
// System.Data.SqlClient.SqlBulkCopyColumnMappingCollection.cs
//
// Author:
// Nagappan A <anagappan@novell.com>
//
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Data.Common;
using System.Collections;
namespace System.Data.SqlClient
{
public sealed class SqlBulkCopyColumnMappingCollection : CollectionBase
{
#region Constructors
internal SqlBulkCopyColumnMappingCollection ()
{
// Do nothing - Created the constructor as the class status page
// was reporting extra constructor which gets generated by default
}
#endregion // Constructors
public SqlBulkCopyColumnMapping this [int index] {
get {
if (index < 0 || index > base.Count)
throw new ArgumentOutOfRangeException ("Index is out of range");
return (SqlBulkCopyColumnMapping) base.List [index];
}
}
#region Methods
public SqlBulkCopyColumnMapping Add (SqlBulkCopyColumnMapping bulkCopyColumnMapping)
{
if (bulkCopyColumnMapping == null)
throw new ArgumentNullException ("bulkCopyColumnMapping");
List.Add (bulkCopyColumnMapping);
return bulkCopyColumnMapping;
}
public SqlBulkCopyColumnMapping Add (int sourceColumnIndex, int destinationColumnIndex)
{
SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumnIndex,
destinationColumnIndex);
return Add (columnMapping);
}
public SqlBulkCopyColumnMapping Add (int sourceColumnIndex, string destinationColumn)
{
SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumnIndex,
destinationColumn);
return Add (columnMapping);
}
public SqlBulkCopyColumnMapping Add (string sourceColumn, int destinationColumnIndex)
{
SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumn,
destinationColumnIndex);
return Add (columnMapping);
}
public SqlBulkCopyColumnMapping Add (string sourceColumn, string destinationColumn)
{
SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumn,
destinationColumn);
return Add (columnMapping);
}
public new void Clear ()
{
List.Clear ();
}
public bool Contains (SqlBulkCopyColumnMapping value)
{
return List.Contains (value);
}
public int IndexOf (SqlBulkCopyColumnMapping value)
{
return List.IndexOf (value);
}
public void CopyTo (SqlBulkCopyColumnMapping [] array, int index)
{
if (index < 0 || index > base.Count)
throw new ArgumentOutOfRangeException ("Index is out of range");
if (array == null)
throw new ArgumentNullException ("array");
int len = base.Count;
if (len - index > array.Length)
len = array.Length;
for (int i = index, j = 0; i < base.Count; i++, j++)
array [j] = (SqlBulkCopyColumnMapping) List [i];
}
public void Insert (int index, SqlBulkCopyColumnMapping value)
{
if (index < 0 || index > base.Count)
throw new ArgumentOutOfRangeException ("Index is out of range");
List.Insert (index, value);
}
public void Remove (SqlBulkCopyColumnMapping value)
{
List.Remove (value);
}
public new void RemoveAt (int index)
{
if (index < 0 || index > base.Count)
throw new ArgumentOutOfRangeException ("Index is out of range");
base.RemoveAt (index);
}
#endregion
}
}

View File

@@ -1,77 +0,0 @@
//
// System.Data.SqlClient.SqlBulkCopyOptions.cs
//
// Author:
// Umadevi S <sumadevi@novell.com>
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Data.SqlClient
{
/// <summary>
/// Bitwise flag that specifies one or more options to use with an instance
/// of the SqlBulkCopy
/// </summary>
[Flags]
public enum SqlBulkCopyOptions {
/// <summary>
/// Use the default values for all options.
/// </summary>
Default = 0,
/// <summary>
/// Preserve source identity values. When not specified,
/// identity values are assigned by the destination.
/// </summary>
KeepIdentity = 1,
/// <summary>
/// Check constraints while data is being inserted.
/// By default, constraints are not checked.
/// </summary>
CheckConstraints = 2,
/// <summary>
/// Obtain a bulk update lock for the duration of the bulk copy operation.
/// When not specified, row locks are used.
/// </summary>
TableLock = 4,
/// <summary>
/// Preserve null values in the destination table regardless of the settings for default values.
/// When not specified, null values are replaced by default values where applicable.
/// </summary>
KeepNulls = 8,
/// <summary>
/// When specified, cause the server to fire the insert triggers
/// for the rows being inserted into the database.
/// </summary>
FireTriggers = 16,
/// <summary>
/// When specified, each batch of the bulk-copy operation will occur within a transaction.
/// If you indicate this option and also provide a SqlTransaction object to the constructor,
/// an ArgumentException occurs.
/// </summary>
UseInternalTransaction = 32
}
}

View File

@@ -1,106 +0,0 @@
//
// System.Data.SqlClient.SqlClientFactory.cs
//
// Author:
// Sureshkumar T (tsureshkumar@novell.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Data;
using System.Data.Common;
using System.Data.Sql;
using System.Security;
using System.Security.Permissions;
namespace System.Data.SqlClient
{
public sealed class SqlClientFactory : DbProviderFactory
{
#region Fields
public static readonly SqlClientFactory Instance = new SqlClientFactory ();
#endregion //Fields
#region Constructors
private SqlClientFactory ()
{
}
#endregion //Constructors
#region Properties
public override bool CanCreateDataSourceEnumerator {
get { return true; }
}
#endregion //Properties
#region public overrides
public override DbCommand CreateCommand ()
{
return new SqlCommand ();
}
public override DbCommandBuilder CreateCommandBuilder ()
{
return new SqlCommandBuilder ();
}
public override DbConnection CreateConnection ()
{
return new SqlConnection ();
}
public override DbConnectionStringBuilder CreateConnectionStringBuilder ()
{
return new SqlConnectionStringBuilder ();
}
public override DbDataAdapter CreateDataAdapter ()
{
return new SqlDataAdapter ();
}
public override DbDataSourceEnumerator CreateDataSourceEnumerator ()
{
return SqlDataSourceEnumerator.Instance;
}
public override DbParameter CreateParameter ()
{
return new SqlParameter ();
}
public override CodeAccessPermission CreatePermission (PermissionState state)
{
return new SqlClientPermission(state);
}
#endregion // public overrides
}
}

View File

@@ -1,55 +0,0 @@
//
// System.Data.SqlClient.SqlClientMetaDataCollectionNames.cs
//
// Author:
// Umadevi S <sumadevi@novell.com>
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Data.SqlClient
{
/// <summary>
/// Collection names
/// </summary>
public static class SqlClientMetaDataCollectionNames {
public static readonly string Columns = "Columns";
public static readonly string Databases = "Databases";
public static readonly string ForeignKeys = "ForeignKeys";
public static readonly string IndexColumns = "IndexColumns";
public static readonly string Indexes = "Indexes";
public static readonly string Parameters = "Parameters";
public static readonly string ProcedureColumns = "ProcedureColumns";
public static readonly string Procedures = "Procedures";
public static readonly string Tables = "Tables";
public static readonly string UserDefinedTypes = "UserDefinedTypes";
public static readonly string Users = "Users";
public static readonly string ViewColumns = "ViewColumns";
public static readonly string Views = "Views";
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,358 +0,0 @@
//
// System.Data.SqlClient.SqlCommandBuilder.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
// Veerapuram Varadhan (vvaradhan@novell.com)
//
// Copyright (C) Tim Coleman, 2002
//
//
// Copyright (C) 2004, 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlTypes;
using System.Text;
namespace System.Data.SqlClient
{
public sealed class SqlCommandBuilder : DbCommandBuilder
{
#region Fields
readonly string _catalogSeparator = ".";
readonly string _schemaSeparator = ".";
readonly CatalogLocation _catalogLocation = CatalogLocation.Start;
#endregion // Fields
#region Constructors
public SqlCommandBuilder ()
{
QuoteSuffix = "]";
QuotePrefix = "[";
}
public SqlCommandBuilder (SqlDataAdapter adapter)
: this ()
{
DataAdapter = adapter;
}
#endregion // Constructors
#region Properties
[DefaultValue (null)]
public new SqlDataAdapter DataAdapter {
get {
return (SqlDataAdapter)base.DataAdapter;
} set {
base.DataAdapter = value;
}
}
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[EditorBrowsable (EditorBrowsableState.Never)]
public
override
string QuotePrefix {
get {
return base.QuotePrefix;
}
set {
if (value != "[" && value != "\"")
throw new ArgumentException ("Only '[' " +
"and '\"' are allowed as value " +
"for the 'QuoteSuffix' property.");
base.QuotePrefix = value;
}
}
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[EditorBrowsable (EditorBrowsableState.Never)]
public
override
string QuoteSuffix {
get {
return base.QuoteSuffix;
}
set {
if (value != "]" && value != "\"")
throw new ArgumentException ("Only ']' " +
"and '\"' are allowed as value " +
"for the 'QuoteSuffix' property.");
base.QuoteSuffix = value;
}
}
[EditorBrowsable (EditorBrowsableState.Never)]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public override string CatalogSeparator {
get { return _catalogSeparator; }
set {
if (value != _catalogSeparator)
throw new ArgumentException ("Only " +
"'.' is allowed as value " +
"for the 'CatalogSeparator' " +
"property.");
}
}
[EditorBrowsable (EditorBrowsableState.Never)]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public override string SchemaSeparator {
get { return _schemaSeparator; }
set {
if (value != _schemaSeparator)
throw new ArgumentException ("Only " +
"'.' is allowed as value " +
"for the 'SchemaSeparator' " +
"property.");
}
}
[EditorBrowsable (EditorBrowsableState.Never)]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public override CatalogLocation CatalogLocation {
get { return _catalogLocation; }
set {
if (value != CatalogLocation.Start)
throw new ArgumentException ("Only " +
"'Start' is allowed as value " +
"for the 'CatalogLocation' " +
"property.");
}
}
#endregion // Properties
#region Methods
public static void DeriveParameters (SqlCommand command)
{
command.DeriveParameters ();
}
public
new
SqlCommand GetDeleteCommand ()
{
return (SqlCommand) base.GetDeleteCommand (false);
}
public
new
SqlCommand GetInsertCommand ()
{
return (SqlCommand) base.GetInsertCommand (false);
}
public
new
SqlCommand GetUpdateCommand ()
{
return (SqlCommand) base.GetUpdateCommand (false);
}
public new SqlCommand GetUpdateCommand (bool useColumnsForParameterNames)
{
return (SqlCommand) base.GetUpdateCommand (useColumnsForParameterNames);
}
public new SqlCommand GetDeleteCommand (bool useColumnsForParameterNames)
{
return (SqlCommand) base.GetDeleteCommand (useColumnsForParameterNames);
}
public new SqlCommand GetInsertCommand (bool useColumnsForParameterNames)
{
return (SqlCommand) base.GetInsertCommand (useColumnsForParameterNames);
}
public override string QuoteIdentifier (string unquotedIdentifier)
{
if (unquotedIdentifier == null)
throw new ArgumentNullException ("unquotedIdentifier");
string prefix = QuotePrefix;
string suffix = QuoteSuffix;
if ((prefix == "[" && suffix != "]") || (prefix == "\"" && suffix != "\""))
throw new ArgumentException ("The QuotePrefix " +
"and QuoteSuffix properties do not match.");
string escaped = unquotedIdentifier.Replace (suffix,
suffix + suffix);
return string.Concat (prefix, escaped, suffix);
}
public override string UnquoteIdentifier (string quotedIdentifier)
{
return base.UnquoteIdentifier (quotedIdentifier);
}
private bool IncludedInInsert (DataRow schemaRow)
{
// If the parameter has one of these properties, then we don't include it in the insert:
// AutoIncrement, Hidden, Expression, RowVersion, ReadOnly
if (!schemaRow.IsNull ("IsAutoIncrement") && (bool) schemaRow ["IsAutoIncrement"])
return false;
if (!schemaRow.IsNull ("IsHidden") && (bool) schemaRow ["IsHidden"])
return false;
if (!schemaRow.IsNull ("IsExpression") && (bool) schemaRow ["IsExpression"])
return false;
if (!schemaRow.IsNull ("IsRowVersion") && (bool) schemaRow ["IsRowVersion"])
return false;
if (!schemaRow.IsNull ("IsReadOnly") && (bool) schemaRow ["IsReadOnly"])
return false;
return true;
}
private bool IncludedInUpdate (DataRow schemaRow)
{
// If the parameter has one of these properties, then we don't include it in the insert:
// AutoIncrement, Hidden, RowVersion
if (!schemaRow.IsNull ("IsAutoIncrement") && (bool) schemaRow ["IsAutoIncrement"])
return false;
if (!schemaRow.IsNull ("IsHidden") && (bool) schemaRow ["IsHidden"])
return false;
if (!schemaRow.IsNull ("IsRowVersion") && (bool) schemaRow ["IsRowVersion"])
return false;
if (!schemaRow.IsNull ("IsExpression") && (bool) schemaRow ["IsExpression"])
return false;
if (!schemaRow.IsNull ("IsReadOnly") && (bool) schemaRow ["IsReadOnly"])
return false;
return true;
}
private bool IncludedInWhereClause (DataRow schemaRow)
{
if ((bool) schemaRow ["IsLong"])
return false;
return true;
}
protected override void ApplyParameterInfo (DbParameter parameter,
DataRow datarow,
StatementType statementType,
bool whereClause)
{
SqlParameter sqlParam = (SqlParameter) parameter;
sqlParam.SqlDbType = (SqlDbType) datarow ["ProviderType"];
object precision = datarow ["NumericPrecision"];
if (precision != DBNull.Value) {
short val = (short) precision;
if (val < byte.MaxValue && val >= byte.MinValue)
sqlParam.Precision = (byte) val;
}
object scale = datarow ["NumericScale"];
if (scale != DBNull.Value) {
short val = ((short) scale);
if (val < byte.MaxValue && val >= byte.MinValue)
sqlParam.Scale = (byte) val;
}
}
protected override
string GetParameterName (int parameterOrdinal)
{
return String.Format ("@p{0}", parameterOrdinal);
}
protected override
string GetParameterName (string parameterName)
{
return String.Format ("@{0}", parameterName);
}
protected override string GetParameterPlaceholder (int parameterOrdinal)
{
return GetParameterName (parameterOrdinal);
}
#endregion // Methods
#region Event Handlers
void RowUpdatingHandler (object sender, SqlRowUpdatingEventArgs args)
{
base.RowUpdatingHandler (args);
}
protected override void SetRowUpdatingHandler (DbDataAdapter adapter)
{
SqlDataAdapter sda = adapter as SqlDataAdapter;
if (sda == null) {
throw new InvalidOperationException ("Adapter needs to be a SqlDataAdapter");
}
if (sda != base.DataAdapter)
sda.RowUpdating += new SqlRowUpdatingEventHandler (RowUpdatingHandler);
else
sda.RowUpdating -= new SqlRowUpdatingEventHandler (RowUpdatingHandler);;
}
protected override DataTable GetSchemaTable (DbCommand srcCommand)
{
using (SqlDataReader rdr = (SqlDataReader) srcCommand.ExecuteReader (CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly))
return rdr.GetSchemaTable ();
}
protected override DbCommand InitializeCommand (DbCommand command)
{
if (command == null) {
command = new SqlCommand ();
} else {
command.CommandTimeout = 30;
command.Transaction = null;
command.CommandType = CommandType.Text;
command.UpdatedRowSource = UpdateRowSource.None;
}
return command;
}
#endregion // Event Handlers
}
}

View File

@@ -1,28 +1,6 @@
//
// SqlCommandBuilder.cs
//
// Author:
// Rolf Bjarne Kvinge <rolf@xamarin.com>
//
// Copyright (c) 2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// 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;
using System.Data;
@@ -36,123 +14,87 @@ namespace System.Data.SqlClient
const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommandBuilder is not supported on the current platform.";
public SqlCommandBuilder ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommandBuilder (SqlDataAdapter adapter)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public static void DeriveParameters (SqlCommand command)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommand GetDeleteCommand ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommand GetInsertCommand ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommand GetUpdateCommand ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommand GetUpdateCommand (bool useColumnsForParameterNames)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommand GetDeleteCommand (bool useColumnsForParameterNames)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlCommand GetInsertCommand (bool useColumnsForParameterNames)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override string QuoteIdentifier (string unquotedIdentifier)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override string UnquoteIdentifier (string quotedIdentifier)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void ApplyParameterInfo (DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override string GetParameterName (int parameterOrdinal)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override string GetParameterName (string parameterName)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override string GetParameterPlaceholder (int parameterOrdinal)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void SetRowUpdatingHandler (DbDataAdapter adapter)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override DataTable GetSchemaTable (DbCommand srcCommand)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override DbCommand InitializeCommand (DbCommand command)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlDataAdapter DataAdapter {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override string QuotePrefix {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override string QuoteSuffix {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override string CatalogSeparator {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override string SchemaSeparator {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override CatalogLocation CatalogLocation {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,214 +1,269 @@
//
// SqlConnection.cs
//
// Author:
// Rolf Bjarne Kvinge <rolf@xamarin.com>
//
// Copyright (c) 2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// 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;
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using System.Transactions;
using Microsoft.SqlServer.Server;
using System.Reflection;
using System.IO;
using System.Globalization;
namespace System.Data.SqlClient
{
public sealed class SqlConnection : DbConnection, IDbConnection, ICloneable
public sealed partial class SqlConnection : DbConnection, ICloneable
{
const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlConnection is not supported on the current platform.";
public SqlConnection () : this (null)
{
}
internal SqlStatistics _statistics;
internal Task _currentReconnectionTask;
internal SessionData _recoverySessionData;
internal bool _suppressStateChangeForReconnection;
internal bool _applyTransientFaultHandling = false;
public SqlConnection (string connectionString)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlConnection (string connectionString, SqlCredential cred)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override string ConnectionString {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public SqlCredential Credentials {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public Guid ClientConnectionId {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override int ConnectionTimeout {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override string Database {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override string DataSource {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public int PacketSize {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override string ServerVersion {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override ConnectionState State {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public string WorkstationId {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public bool FireInfoMessageEventOnUserErrors {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public SqlConnection() : base() => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlConnection(string connectionString) : this() {}
public bool StatisticsEnabled {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
protected override DbProviderFactory DbProviderFactory {
internal bool AsyncCommandInProgress {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
internal SqlConnectionString.TransactionBindingEnum TransactionBinding
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal SqlConnectionString.TypeSystem TypeSystem
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal Version TypeSystemAssemblyVersion
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal int ConnectRetryInterval
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override string ConnectionString {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override int ConnectionTimeout
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override string Database
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override string DataSource
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public int PacketSize
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public Guid ClientConnectionId
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override string ServerVersion
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override ConnectionState State
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal SqlStatistics Statistics
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public string WorkstationId
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override DbProviderFactory DbProviderFactory
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public event SqlInfoMessageEventHandler InfoMessage;
public new SqlTransaction BeginTransaction ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public bool FireInfoMessageEventOnUserErrors {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public new SqlTransaction BeginTransaction (IsolationLevel iso)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal int ReconnectCount
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal bool ForceNewConnection {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public SqlTransaction BeginTransaction (string transactionName)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void OnStateChange(StateChangeEventArgs stateChange)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
new public SqlTransaction BeginTransaction()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
new public SqlTransaction BeginTransaction(IsolationLevel iso)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlTransaction BeginTransaction(string transactionName)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
override protected DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public SqlTransaction BeginTransaction(IsolationLevel iso, string transactionName)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override void ChangeDatabase(string database)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public static void ClearAllPools()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public static void ClearPool(SqlConnection connection)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override void Close()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
new public SqlCommand CreateCommand()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override void Open()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void RegisterWaitingForReconnect(Task waitingTask)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal Task ValidateAndReconnect(Action beforeDisconnect, int timeout)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override Task OpenAsync(CancellationToken cancellationToken)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override DataTable GetSchema()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override DataTable GetSchema(string collectionName)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override DataTable GetSchema(string collectionName, string[] restrictionValues)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal bool HasLocalTransaction
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal bool HasLocalTransactionFromAPI
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal bool IsKatmaiOrNewer
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal TdsParser Parser
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void ValidateConnectionForExecute(string method, SqlCommand command)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal static string FixupDatabaseTransactionName(string name)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal SqlInternalConnectionTds GetOpenTdsConnection()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal SqlInternalConnectionTds GetOpenTdsConnection(string method)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void OnInfoMessage(SqlInfoMessageEventArgs imevent)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void OnInfoMessage(SqlInfoMessageEventArgs imevent, out bool notified)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void RegisterForConnectionCloseNotification<T>(ref Task<T> outerTask, object value, int tag)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public void ResetStatistics()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public IDictionary RetrieveStatistics()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
object ICloneable.Clone()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal void CheckGetExtendedUDTInfo(SqlMetaDataPriv metaData, bool fThrow)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal object GetUdtValue(object value, SqlMetaDataPriv metaData, bool returnDBNull)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal byte[] GetBytes(object o)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal byte[] GetBytes(object o, out Format format, out int maxSize)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal int CloseCount
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal DbConnectionFactory ConnectionFactory
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal DbConnectionOptions ConnectionOptions
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal DbConnectionInternal InnerConnection
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
internal System.Data.ProviderBase.DbConnectionPoolGroup PoolGroup {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SqlTransaction BeginTransaction (IsolationLevel iso, string transactionName)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal DbConnectionOptions UserConnectionOptions
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override void ChangeDatabase (string database)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void Abort(Exception e)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override void Close ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void AddWeakReference(object value, int tag)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public new SqlCommand CreateCommand ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
override protected DbCommand CreateDbCommand()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void Dispose (bool disposing)
{
}
override protected void Dispose(bool disposing) {}
#if !MOBILE
public void EnlistDistributedTransaction (ITransaction transaction)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
#endif
public override void EnlistTransaction(Transaction transaction)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
object ICloneable.Clone ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void NotifyWeakReference(int message)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void PermissionDemand()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override DbCommand CreateDbCommand ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void RemoveWeakReference(object value)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override void Open ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void SetInnerConnectionEvent(DbConnectionInternal to)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override DataTable GetSchema ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal bool SetInnerConnectionFrom(DbConnectionInternal to, DbConnectionInternal from)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public override DataTable GetSchema (String collectionName)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override DataTable GetSchema (String collectionName, string [] restrictionValues)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public static void ChangePassword (string connectionString, string newPassword)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public static void ClearAllPools ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public static void ClearPool (SqlConnection connection)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public void ResetStatistics ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public IDictionary RetrieveStatistics ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
internal void SetInnerConnectionTo(DbConnectionInternal to)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
}

View File

@@ -1,498 +0,0 @@
//
// System.Data.SqlClient.SqlDataAdapter.cs
//
// Author:
// Rodrigo Moya (rodrigo@ximian.com)
// Daniel Morgan (danmorg@sc.rr.com)
// Tim Coleman (tim@timcoleman.com)
// Veerapuram Varadhan (vvaradhan@novell.com)
//
// (C) Ximian, Inc 2002
// Copyright (C) 2002 Tim Coleman
//
// Copyright (C) 2004, 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
namespace System.Data.SqlClient {
[DefaultEvent ("RowUpdated")]
[DesignerAttribute ("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]
[ToolboxItemAttribute ("Microsoft.VSDesigner.Data.VS.SqlDataAdapterToolboxItem, "+ Consts.AssemblyMicrosoft_VSDesigner)]
public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter, IDataAdapter, ICloneable
{
#region Copy from old DataColumn
internal static bool CanAutoIncrement (Type type)
{
switch (Type.GetTypeCode (type)) {
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.Decimal:
return true;
}
return false;
}
#endregion
#region Copy from old DataAdapter
private const string DefaultSourceColumnName = "Column";
internal FillErrorEventArgs CreateFillErrorEvent (DataTable dataTable, object[] values, Exception e)
{
FillErrorEventArgs args = new FillErrorEventArgs (dataTable, values);
args.Errors = e;
args.Continue = false;
return args;
}
internal void OnFillErrorInternal (FillErrorEventArgs value)
{
OnFillError (value);
}
// this method builds the schema for a given datatable. it returns a int array with
// "array[ordinal of datatable column] == index of source column in data reader".
// each column in the datatable has a mapping to a specific column in the datareader,
// the int array represents this match.
internal int[] BuildSchema (IDataReader reader, DataTable table, SchemaType schemaType)
{
return BuildSchema (reader, table, schemaType, MissingSchemaAction,
MissingMappingAction, TableMappings);
}
/// <summary>
/// Creates or Modifies the schema of the given DataTable based on the schema of
/// the reader and the arguments passed.
/// </summary>
internal static int[] BuildSchema (IDataReader reader, DataTable table,
SchemaType schemaType,
MissingSchemaAction missingSchAction,
MissingMappingAction missingMapAction,
DataTableMappingCollection dtMapping
)
{
int readerIndex = 0;
// FIXME : this fails if query has fewer columns than a table
int[] mapping = new int[table.Columns.Count]; // mapping the reader indexes to the datatable indexes
for(int i=0; i < mapping.Length; i++) {
mapping[i] = -1;
}
ArrayList primaryKey = new ArrayList ();
ArrayList sourceColumns = new ArrayList ();
bool createPrimaryKey = true;
DataTable schemaTable = reader.GetSchemaTable ();
DataColumn ColumnNameCol = schemaTable.Columns["ColumnName"];
DataColumn DataTypeCol = schemaTable.Columns["DataType"];
DataColumn IsAutoIncrementCol = schemaTable.Columns["IsAutoIncrement"];
DataColumn AllowDBNullCol = schemaTable.Columns["AllowDBNull"];
DataColumn IsReadOnlyCol = schemaTable.Columns["IsReadOnly"];
DataColumn IsKeyCol = schemaTable.Columns["IsKey"];
DataColumn IsUniqueCol = schemaTable.Columns["IsUnique"];
DataColumn ColumnSizeCol = schemaTable.Columns["ColumnSize"];
foreach (DataRow schemaRow in schemaTable.Rows) {
// generate a unique column name in the source table.
string sourceColumnName;
string realSourceColumnName ;
if (ColumnNameCol == null || schemaRow.IsNull(ColumnNameCol) ||
(string)schemaRow [ColumnNameCol] == String.Empty) {
sourceColumnName = DefaultSourceColumnName;
realSourceColumnName = DefaultSourceColumnName + "1";
} else {
sourceColumnName = (string) schemaRow [ColumnNameCol];
realSourceColumnName = sourceColumnName;
}
for (int i = 1; sourceColumns.Contains (realSourceColumnName); i += 1)
realSourceColumnName = String.Format ("{0}{1}", sourceColumnName, i);
sourceColumns.Add(realSourceColumnName);
// generate DataSetColumnName from DataTableMapping, if any
DataTableMapping tableMapping = null;
//FIXME : The sourcetable name shud get passed as a parameter..
int index = dtMapping.IndexOfDataSetTable (table.TableName);
string srcTable = (index != -1 ? dtMapping[index].SourceTable : table.TableName);
tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (dtMapping, ADP.IsEmpty (srcTable) ? " " : srcTable, table.TableName, missingMapAction);
if (tableMapping != null) {
table.TableName = tableMapping.DataSetTable;
// check to see if the column mapping exists
DataColumnMapping columnMapping = DataColumnMappingCollection.GetColumnMappingBySchemaAction(tableMapping.ColumnMappings, realSourceColumnName, missingMapAction);
if (columnMapping != null) {
Type columnType = schemaRow[DataTypeCol] as Type;
DataColumn col = columnType != null ? columnMapping.GetDataColumnBySchemaAction(
table ,
columnType,
missingSchAction) : null;
if (col != null) {
// if the column is not in the table - add it.
if (table.Columns.IndexOf(col) == -1) {
if (missingSchAction == MissingSchemaAction.Add
|| missingSchAction == MissingSchemaAction.AddWithKey)
table.Columns.Add(col);
int[] tmp = new int[mapping.Length + 1];
Array.Copy(mapping,0,tmp,0,col.Ordinal);
Array.Copy(mapping,col.Ordinal,tmp,col.Ordinal + 1,mapping.Length - col.Ordinal);
mapping = tmp;
}
if (missingSchAction == MissingSchemaAction.AddWithKey) {
object value = (AllowDBNullCol != null) ? schemaRow[AllowDBNullCol] : null;
bool allowDBNull = value is bool ? (bool)value : true;
value = (IsKeyCol != null) ? schemaRow[IsKeyCol] : null;
bool isKey = value is bool ? (bool)value : false;
value = (IsAutoIncrementCol != null) ? schemaRow[IsAutoIncrementCol] : null;
bool isAutoIncrement = value is bool ? (bool)value : false;
value = (IsReadOnlyCol != null) ? schemaRow[IsReadOnlyCol] : null;
bool isReadOnly = value is bool ? (bool)value : false;
value = (IsUniqueCol != null) ? schemaRow[IsUniqueCol] : null;
bool isUnique = value is bool ? (bool)value : false;
col.AllowDBNull = allowDBNull;
// fill woth key info
if (isAutoIncrement && CanAutoIncrement(columnType)) {
col.AutoIncrement = true;
if (!allowDBNull)
col.AllowDBNull = false;
}
if (columnType == DbTypes.TypeOfString) {
col.MaxLength = (ColumnSizeCol != null) ? (int)schemaRow[ColumnSizeCol] : 0;
}
if (isReadOnly)
col.ReadOnly = true;
if (!allowDBNull && (!isReadOnly || isKey))
col.AllowDBNull = false;
if (isUnique && !isKey && !columnType.IsArray) {
col.Unique = true;
if (!allowDBNull)
col.AllowDBNull = false;
}
// This might not be set by all DataProviders
bool isHidden = false;
if (schemaTable.Columns.Contains ("IsHidden")) {
value = schemaRow["IsHidden"];
isHidden = ((value is bool) ? (bool)value : false);
}
if (isKey && !isHidden) {
primaryKey.Add (col);
if (allowDBNull)
createPrimaryKey = false;
}
}
// 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++;
}
}
}
}
if (primaryKey.Count > 0) {
DataColumn[] colKey = (DataColumn[])(primaryKey.ToArray(typeof (DataColumn)));
if (createPrimaryKey)
table.PrimaryKey = colKey;
else {
UniqueConstraint uConstraint = new UniqueConstraint(colKey);
for (int i = 0; i < table.Constraints.Count; i++) {
if (table.Constraints[i].Equals(uConstraint)) {
uConstraint = null;
break;
}
}
if (uConstraint != null)
table.Constraints.Add(uConstraint);
}
}
return mapping;
}
internal int FillInternal (DataTable dataTable, IDataReader dataReader)
{
if (dataReader.FieldCount == 0) {
dataReader.Close ();
return 0;
}
int count = 0;
try {
string tableName = SetupSchema (SchemaType.Mapped, dataTable.TableName);
if (tableName != null) {
dataTable.TableName = tableName;
FillTable (dataTable, dataReader, 0, 0, ref count);
}
} finally {
dataReader.Close ();
}
return count;
}
internal bool FillTable (DataTable dataTable, IDataReader dataReader, int startRecord, int maxRecords, ref int counter)
{
if (dataReader.FieldCount == 0)
return false;
int counterStart = counter;
int[] mapping = BuildSchema (dataReader, dataTable, SchemaType.Mapped);
int [] sortedMapping = new int [mapping.Length];
int length = sortedMapping.Length;
for (int i = 0; i < sortedMapping.Length; i++) {
if (mapping [i] >= 0)
sortedMapping [mapping [i]] = i;
else
sortedMapping [--length] = i;
}
for (int i = 0; i < startRecord; i++) {
dataReader.Read ();
}
dataTable.BeginLoadData ();
object [] values = new object [length];
while (dataReader.Read () && (maxRecords == 0 || (counter - counterStart) < maxRecords)) {
try {
for (int iColumn = 0; iColumn < values.Length; iColumn++)
values [iColumn] = dataReader [iColumn];
dataTable.LoadDataRow (values, AcceptChangesDuringFill);
counter++;
}
catch (Exception e) {
object[] readerArray = new object [dataReader.FieldCount];
object[] tableArray = new object [mapping.Length];
// we get the values from the datareader
dataReader.GetValues (readerArray);
// copy from datareader columns to table columns according to given mapping
for (int i = 0; i < mapping.Length; i++) {
if (mapping [i] >= 0) {
tableArray [i] = readerArray [mapping [i]];
}
}
FillErrorEventArgs args = CreateFillErrorEvent (dataTable, tableArray, e);
OnFillErrorInternal (args);
// if args.Continue is not set to true or if a handler is not set, rethrow the error..
if(!args.Continue)
throw e;
}
}
dataTable.EndLoadData ();
return true;
}
internal string SetupSchema (SchemaType schemaType, string sourceTableName)
{
DataTableMapping tableMapping = null;
if (schemaType == SchemaType.Mapped) {
tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, sourceTableName, sourceTableName, MissingMappingAction);
if (tableMapping != null)
return tableMapping.DataSetTable;
return null;
} else
return sourceTableName;
}
#endregion
#region Fields
int updateBatchSize;
#endregion
#region Constructors
public SqlDataAdapter () : this ((SqlCommand) null)
{
}
public SqlDataAdapter (SqlCommand selectCommand)
{
SelectCommand = selectCommand;
UpdateBatchSize = 1;
}
public SqlDataAdapter (string selectCommandText, SqlConnection selectConnection)
: this (new SqlCommand (selectCommandText, selectConnection))
{
}
public SqlDataAdapter (string selectCommandText, string selectConnectionString)
: this (selectCommandText, new SqlConnection (selectConnectionString))
{
}
#endregion
#region Properties
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
public new SqlCommand DeleteCommand { get; set; }
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
public new SqlCommand InsertCommand { get; set; }
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
public new SqlCommand SelectCommand { get; set; }
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
public new SqlCommand UpdateCommand { get; set; }
IDbCommand IDbDataAdapter.SelectCommand {
get { return SelectCommand; }
set { SelectCommand = (SqlCommand) value; }
}
IDbCommand IDbDataAdapter.InsertCommand {
get { return InsertCommand; }
set { InsertCommand = (SqlCommand) value; }
}
IDbCommand IDbDataAdapter.UpdateCommand {
get { return UpdateCommand; }
set { UpdateCommand = (SqlCommand) value; }
}
IDbCommand IDbDataAdapter.DeleteCommand {
get { return DeleteCommand; }
set { DeleteCommand = (SqlCommand) value; }
}
public override int UpdateBatchSize {
get { return updateBatchSize; }
set {
if (value < 0)
throw new ArgumentOutOfRangeException ("UpdateBatchSize");
updateBatchSize = value;
}
}
#endregion // Properties
#region Methods
protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
{
return new SqlRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
}
protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
{
return new SqlRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
}
protected override void OnRowUpdated (RowUpdatedEventArgs value)
{
if (RowUpdated != null)
RowUpdated (this, (SqlRowUpdatedEventArgs) value);
}
protected override void OnRowUpdating (RowUpdatingEventArgs value)
{
if (RowUpdating != null)
RowUpdating (this, (SqlRowUpdatingEventArgs) value);
}
[MonoTODO]
object ICloneable.Clone()
{
throw new NotImplementedException ();
}
// All the batch methods, should be implemented, if supported,
// by individual providers
[MonoTODO]
protected override int AddToBatch (IDbCommand command)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override void ClearBatch ()
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override int ExecuteBatch ()
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override IDataParameter GetBatchedParameter (int commandIdentifier, int parameterIndex)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override void InitializeBatching ()
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override void TerminateBatching ()
{
throw new NotImplementedException ();
}
#endregion // Methods
#region Events and Delegates
public event SqlRowUpdatedEventHandler RowUpdated;
public event SqlRowUpdatingEventHandler RowUpdating;
#endregion // Events and Delegates
}
}

View File

@@ -0,0 +1,106 @@
// 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;
using System.Collections;
using System.ComponentModel;
using System.Data.Common;
using System.Diagnostics;
namespace System.Data.SqlClient
{
public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter, ICloneable
{
const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlDataAdapter is not supported on the current platform.";
public SqlDataAdapter() : base() {}
public SqlDataAdapter(SqlCommand selectCommand) : this() {}
public SqlDataAdapter(string selectCommandText, string selectConnectionString) : this() {}
public SqlDataAdapter(string selectCommandText, SqlConnection selectConnection) : this() {}
new public SqlCommand DeleteCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
IDbCommand IDbDataAdapter.DeleteCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
new public SqlCommand InsertCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
IDbCommand IDbDataAdapter.InsertCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
new public SqlCommand SelectCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
IDbCommand IDbDataAdapter.SelectCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
new public SqlCommand UpdateCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
IDbCommand IDbDataAdapter.UpdateCommand {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override int UpdateBatchSize {
get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
protected override int AddToBatch(IDbCommand command)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void ClearBatch()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override int ExecuteBatch()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override IDataParameter GetBatchedParameter(int commandIdentifier, int parameterIndex)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override bool GetBatchedRecordsAffected(int commandIdentifier, out int recordsAffected, out Exception error)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void InitializeBatching()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override void TerminateBatching()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
object ICloneable.Clone()
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
public event SqlRowUpdatedEventHandler RowUpdated;
public event SqlRowUpdatingEventHandler RowUpdating;
override protected void OnRowUpdated(RowUpdatedEventArgs value)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
override protected void OnRowUpdating(RowUpdatingEventArgs value)
=> throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
}

Some files were not shown because too many files have changed in this diff Show More