public Task RollbackAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(Rollback(true)); }
public override Task <int> ReadAsync([NotNull] byte[] buffer, int offset, int count, CancellationToken token) { token.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(Read(buffer, offset, count, true)); }
public override Task <T> GetFieldValueAsync <T>(int ordinal, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(GetFieldValue <T>(ordinal, true)); }
/// <summary> /// An asynchronous version of <see cref="IsDBNull(int)"/>, which gets a value that indicates whether the column contains non-existent or missing values. /// The <paramref name="cancellationToken"/> parameter is currently ignored. /// </summary> /// <param name="ordinal">The zero-based column to be retrieved.</param> /// <param name="cancellationToken">Currently ignored.</param> /// <returns><b>true</b> if the specified column value is equivalent to <see cref="DBNull"/> otherwise <b>false</b>.</returns> public override Task <bool> IsDBNullAsync(int ordinal, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(IsDBNull(ordinal, true)); }
/// <summary> /// Writes <i>count</i> bytes to the large object. /// </summary> /// <param name="buffer">The buffer to write data from.</param> /// <param name="offset">The offset in the buffer at which to begin copying bytes.</param> /// <param name="count">The number of bytes to write.</param> /// <param name="cancellationToken">Cancellation token.</param> public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(Write(buffer, offset, count, true)); }
/// <summary> /// Imports a large object to be stored as a large object in the database from a file stored on the backend. This requires superuser permissions. /// </summary> /// <param name="path">Path to read the file on the backend</param> /// <param name="oid">A preferred oid, or specify 0 if one should be automatically assigned</param> /// <param name="cancellationToken">Cancellation token.</param> public Task ImportRemoteAsync(string path, uint oid, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(ExecuteFunction <object>("lo_import", true, path, (int)oid)); }
/// <summary> /// Deletes a large object on the backend. /// </summary> /// <param name="oid">Oid of the object to delete</param> /// <param name="cancellationToken">Cancellation token.</param> public Task UnlinkAsync(uint oid, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(ExecuteFunction <object>("lo_unlink", true, (int)oid)); }
/// <summary> /// Opens a large object on the backend, returning a stream controlling this remote object. /// Note that this method, as well as operations on the stream must be wrapped inside a transaction. /// </summary> /// <param name="oid">Oid of the object</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>An NpgsqlLargeObjectStream</returns> public Task <NpgsqlLargeObjectStream> OpenReadWriteAsync(uint oid, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (NoSynchronizationContextScope.Enter()) return(OpenReadWrite(oid, true)); }