1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Collections.Generic; 6 using System.Data.Common; 7 using System.Data.Sql; 8 using System.Data.SqlTypes; 9 using System.Diagnostics; 10 using System.IO; 11 using System.Runtime.CompilerServices; 12 using System.Text; 13 using System.Threading; 14 using System.Threading.Tasks; 15 using System.Xml; 16 17 using Microsoft.SqlServer.Server; 18 19 namespace System.Data.SqlClient 20 { 21 public sealed partial class SqlCommand : DbCommand, ICloneable 22 { 23 const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommand is not supported on the current platform."; 24 25 internal SqlDependency _sqlDep; 26 internal int _rowsAffected = -1; 27 internal bool InPrepare 28 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 29 SqlCommand()30 public SqlCommand() : base() => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); SqlCommand(string cmdText)31 public SqlCommand(string cmdText) : this() {} SqlCommand(string cmdText, SqlConnection connection)32 public SqlCommand(string cmdText, SqlConnection connection) : this() {} SqlCommand(string cmdText, SqlConnection connection, SqlTransaction transaction)33 public SqlCommand(string cmdText, SqlConnection connection, SqlTransaction transaction) : this() {} 34 35 new public SqlConnection Connection { 36 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 37 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 38 } 39 40 override protected DbConnection DbConnection { 41 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 42 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 43 } 44 45 public SqlNotificationRequest Notification { 46 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 47 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 48 } 49 50 internal SqlStatistics Statistics 51 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 52 53 new public SqlTransaction Transaction { 54 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 55 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 56 } 57 58 override protected DbTransaction DbTransaction { 59 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 60 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 61 } 62 63 override public string CommandText { 64 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 65 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 66 } 67 68 override public int CommandTimeout { 69 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 70 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 71 } 72 ResetCommandTimeout()73 public void ResetCommandTimeout() 74 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 75 76 override public CommandType CommandType { 77 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 78 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 79 } 80 81 #if DEBUG 82 internal static int DebugForceAsyncWriteDelay { 83 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 84 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 85 } 86 #endif 87 88 public override bool DesignTimeVisible { 89 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 90 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 91 } 92 93 new public SqlParameterCollection Parameters 94 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 95 96 override protected DbParameterCollection DbParameterCollection 97 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 98 99 override public UpdateRowSource UpdatedRowSource { 100 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 101 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 102 } 103 104 public event StatementCompletedEventHandler StatementCompleted; 105 OnStatementCompleted(int recordCount)106 internal void OnStatementCompleted(int recordCount) 107 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 108 Prepare()109 override public void Prepare() 110 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 111 Unprepare()112 internal void Unprepare() 113 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 114 Cancel()115 override public void Cancel() 116 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 117 CreateParameter()118 new public SqlParameter CreateParameter() 119 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 120 CreateDbParameter()121 override protected DbParameter CreateDbParameter() 122 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 123 Dispose(bool disposing)124 override protected void Dispose(bool disposing) {} 125 ExecuteScalar()126 override public object ExecuteScalar() 127 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 128 ExecuteNonQuery()129 override public int ExecuteNonQuery() 130 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 131 ExecuteXmlReader()132 public XmlReader ExecuteXmlReader() 133 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 134 135 override protected DbDataReader ExecuteDbDataReader(CommandBehavior behavior) 136 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 137 ExecuteReader()138 new public SqlDataReader ExecuteReader() 139 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 140 141 new public SqlDataReader ExecuteReader(CommandBehavior behavior) 142 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 143 144 internal SqlDataReader EndExecuteReader(IAsyncResult asyncResult) 145 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 146 BeginExecuteReader(CommandBehavior behavior, AsyncCallback callback, object stateObject)147 internal IAsyncResult BeginExecuteReader(CommandBehavior behavior, AsyncCallback callback, object stateObject) 148 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 149 150 public override Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken) 151 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 152 ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)153 protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) 154 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 155 ExecuteReaderAsync()156 new public Task<SqlDataReader> ExecuteReaderAsync() 157 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 158 159 new public Task<SqlDataReader> ExecuteReaderAsync(CommandBehavior behavior) 160 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 161 162 new public Task<SqlDataReader> ExecuteReaderAsync(CancellationToken cancellationToken) 163 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 164 ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)165 new public Task<SqlDataReader> ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) 166 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 167 168 public override Task<object> ExecuteScalarAsync(CancellationToken cancellationToken) 169 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 170 ExecuteXmlReaderAsync()171 public Task<XmlReader> ExecuteXmlReaderAsync() 172 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 173 174 public Task<XmlReader> ExecuteXmlReaderAsync(CancellationToken cancellationToken) 175 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 176 177 internal static readonly string[] PreKatmaiProcParamsNames = new string[] {}; 178 179 internal static readonly string[] KatmaiProcParamsNames = new string[] {}; 180 DeriveParameters()181 internal void DeriveParameters() 182 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 183 184 internal _SqlMetaDataSet MetaData 185 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 186 RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, [CallerMemberName] string method = R)187 internal SqlDataReader RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, [CallerMemberName] string method = "") 188 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 189 RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, TaskCompletionSource<object> completion, int timeout, out Task task, bool asyncWrite = false, [CallerMemberName] string method = R)190 internal SqlDataReader RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, TaskCompletionSource<object> completion, int timeout, out Task task, bool asyncWrite = false, [CallerMemberName] string method = "") 191 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 192 OnDoneProc()193 internal void OnDoneProc() 194 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 195 OnReturnStatus(int status)196 internal void OnReturnStatus(int status) 197 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 198 199 internal void OnReturnValue(SqlReturnValue rec) 200 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 201 OnReturnValue(SqlReturnValue rec, TdsParserStateObject stateObj)202 internal void OnReturnValue(SqlReturnValue rec, TdsParserStateObject stateObj) 203 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 204 BuildParamList(TdsParser parser, SqlParameterCollection parameters)205 internal string BuildParamList(TdsParser parser, SqlParameterCollection parameters) 206 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 207 CheckThrowSNIException()208 internal void CheckThrowSNIException() 209 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 210 OnConnectionClosed()211 internal void OnConnectionClosed() 212 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 213 214 internal TdsParserStateObject StateObject 215 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 216 217 internal bool IsDirty { 218 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 219 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 220 } 221 222 internal int InternalRecordsAffected { 223 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 224 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 225 } 226 ClearBatchCommand()227 internal void ClearBatchCommand() 228 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 229 230 internal bool BatchRPCMode { 231 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 232 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 233 } 234 AddBatchCommand(string commandText, SqlParameterCollection parameters, CommandType cmdType)235 internal void AddBatchCommand(string commandText, SqlParameterCollection parameters, CommandType cmdType) 236 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 237 ExecuteBatchRPCCommand()238 internal int ExecuteBatchRPCCommand() 239 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 240 GetRecordsAffected(int commandIndex)241 internal int? GetRecordsAffected(int commandIndex) 242 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 243 GetErrors(int commandIndex)244 internal SqlException GetErrors(int commandIndex) 245 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 246 247 #if DEBUG 248 internal void CompletePendingReadWithSuccess(bool resetForcePendingReadsToWait) 249 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 250 CompletePendingReadWithFailure(int errorCode, bool resetForcePendingReadsToWait)251 internal void CompletePendingReadWithFailure(int errorCode, bool resetForcePendingReadsToWait) 252 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 253 #endif 254 CancelIgnoreFailure()255 internal void CancelIgnoreFailure() 256 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 257 ICloneable.Clone()258 object ICloneable.Clone() 259 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 260 Clone()261 public SqlCommand Clone() 262 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 263 264 public bool NotificationAutoEnlist { 265 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 266 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 267 } 268 BeginExecuteNonQuery()269 public IAsyncResult BeginExecuteNonQuery() 270 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 271 BeginExecuteXmlReader()272 public IAsyncResult BeginExecuteXmlReader() 273 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 274 BeginExecuteReader()275 public IAsyncResult BeginExecuteReader() 276 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 277 BeginExecuteReader(AsyncCallback callback, object stateObject)278 public IAsyncResult BeginExecuteReader(AsyncCallback callback, object stateObject) 279 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 280 BeginExecuteReader(AsyncCallback callback, object stateObject, CommandBehavior behavior)281 public IAsyncResult BeginExecuteReader(AsyncCallback callback, object stateObject, CommandBehavior behavior) 282 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 283 284 public IAsyncResult BeginExecuteReader(CommandBehavior behavior) 285 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); 286 } 287 } 288