diff options
author | Marek Safar <marek.safar@gmail.com> | 2012-07-19 22:04:26 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2012-07-19 22:04:26 +0400 |
commit | 6ea7843351f28388dcfd207d1201e3ea4486324c (patch) | |
tree | 2543e75ab18ac691a8ef20f5f4d35cf6124c7727 /mcs/class/System.Data | |
parent | b24d5c6198b5f3018d7ddbaa398bcac509349f2e (diff) |
Add some new async methods
Diffstat (limited to 'mcs/class/System.Data')
3 files changed, 127 insertions, 13 deletions
diff --git a/mcs/class/System.Data/System.Data.Common/DbCommand.cs b/mcs/class/System.Data/System.Data.Common/DbCommand.cs index acddb222c4d..2eb219032ca 100644 --- a/mcs/class/System.Data/System.Data.Common/DbCommand.cs +++ b/mcs/class/System.Data/System.Data.Common/DbCommand.cs @@ -30,11 +30,14 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if NET_2_0 || TARGET_JVM - using System.ComponentModel; using System.Data; +#if NET_4_5 +using System.Threading; +using System.Threading.Tasks; +#endif + namespace System.Data.Common { public abstract class DbCommand : Component, IDbCommand, IDisposable { @@ -147,9 +150,60 @@ namespace System.Data.Common { public abstract void Prepare (); +#if NET_4_5 + [MonoTODO] + protected virtual Task<DbDataReader> ExecuteDbDataReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + public Task<int> ExecuteNonQueryAsync () + { + return ExecuteNonQueryAsync (CancellationToken.None); + } + + [MonoTODO] + public virtual Task<int> ExecuteNonQueryAsync (CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + public Task<Object> ExecuteScalarAsync () + { + return ExecuteScalarAsync (CancellationToken.None); + } + + [MonoTODO] + public virtual Task<Object> ExecuteScalarAsync (CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + public Task<DbDataReader> ExecuteReaderAsync () + { + return ExecuteReaderAsync (CancellationToken.None); + } + + [MonoTODO] + public Task<DbDataReader> ExecuteReaderAsync (CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + public Task<DbDataReader> ExecuteReaderAsync (CommandBehavior behavior) + { + return ExecuteReaderAsync (behavior, CancellationToken.None); + } + + [MonoTODO] + public Task<DbDataReader> ExecuteReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + +#endif + #endregion // Methods } } - -#endif diff --git a/mcs/class/System.Data/System.Data.Common/DbConnection.cs b/mcs/class/System.Data/System.Data.Common/DbConnection.cs index dad77673bbc..ce68ec9cef7 100644 --- a/mcs/class/System.Data/System.Data.Common/DbConnection.cs +++ b/mcs/class/System.Data/System.Data.Common/DbConnection.cs @@ -30,14 +30,17 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if NET_2_0 || TARGET_JVM - using System.ComponentModel; using System.Data; #if NET_2_0 && !TARGET_JVM using System.Transactions; #endif +#if NET_4_5 +using System.Threading; +using System.Threading.Tasks; +#endif + namespace System.Data.Common { public abstract class DbConnection : Component, IDbConnection, IDisposable { @@ -50,9 +53,7 @@ namespace System.Data.Common { #endregion // Constructors #region Properties -#pragma warning disable 618 [RecommendedAsConfigurable (true)] -#pragma warning restore 618 [RefreshProperties (RefreshProperties.All)] [DefaultValue ("")] public abstract string ConnectionString { get; set; } @@ -748,6 +749,19 @@ namespace System.Data.Common { if (StateChange != null) StateChange (this, stateChange); } + +#if NET_4_5 + public Task OpenAsync () + { + return OpenAsync (CancellationToken.None); + } + + [MonoTODO] + public virtual Task OpenAsync (CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } +#endif #endregion // Methods @@ -755,5 +769,3 @@ namespace System.Data.Common { } } - -#endif diff --git a/mcs/class/System.Data/System.Data.Common/DbDataReader.cs b/mcs/class/System.Data/System.Data.Common/DbDataReader.cs index b7eac3ee159..561066614f8 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataReader.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataReader.cs @@ -30,12 +30,15 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if NET_2_0 || TARGET_JVM - using System.Collections; using System.ComponentModel; using System.Data; +#if NET_4_5 +using System.Threading; +using System.Threading.Tasks; +#endif + namespace System.Data.Common { public abstract class DbDataReader : MarshalByRefObject, IDataReader, IDataRecord, IDisposable, IEnumerable { @@ -183,9 +186,54 @@ namespace System.Data.Common { return schemaTable; } + +#if NET_4_5 + public Task<T> GetFieldValueAsync<T> (int ordinal) + { + return GetFieldValueAsync<T> (ordinal, CancellationToken.None); + } + + [MonoTODO] + public virtual Task<T> GetFieldValueAsync<T> (int ordinal, CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + public Task<bool> NextResultAsync () + { + return NextResultAsync (CancellationToken.None); + } + + public Task<bool> IsDBNullAsync (int ordinal) + { + return IsDBNullAsync (ordinal, CancellationToken.None); + } + + [MonoTODO] + public virtual Task<bool> IsDBNullAsync (int ordinal, CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual Task<bool> NextResultAsync (CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } + + public Task<bool> ReadAsync () + { + return ReadAsync (CancellationToken.None); + } + + [MonoTODO] + public virtual Task<bool> ReadAsync (CancellationToken cancellationToken) + { + throw new NotImplementedException (); + } +#endif #endregion // Methods } } -#endif |