public async Task <FbBatchNonQueryResult> ExecuteNonQueryAsync(CancellationToken cancellationToken = default) { CheckCommand(); FbBatchNonQueryResult result; using (var explicitCancellation = ExplicitCancellation.Enter(cancellationToken, Cancel)) { try { result = await ExecuteCommandAsync(false, explicitCancellation.CancellationToken).ConfigureAwait(false); //if (_statement.StatementType == DbStatementType.StoredProcedure) //{ // await SetOutputParametersAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); //} await CommitImplicitTransactionAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); } catch (IscException ex) { await RollbackImplicitTransactionAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); throw FbException.Create(ex); } catch { await RollbackImplicitTransactionAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); throw; } } return(result); }
public FbBatchNonQueryResult ExecuteNonQuery() { CheckCommand(); FbBatchNonQueryResult result; using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, Cancel)) { try { result = ExecuteCommand(false); //if (_statement.StatementType == DbStatementType.StoredProcedure) //{ // SetOutputParameters(); //} CommitImplicitTransaction(); } catch (IscException ex) { RollbackImplicitTransaction(); throw FbException.Create(ex); } catch { RollbackImplicitTransaction(); throw; } } return(result); }
public override async Task <bool> ReadAsync(CancellationToken cancellationToken) { CheckState(); if (IsCommandBehavior(CommandBehavior.SchemaOnly)) { return(false); } else if (IsCommandBehavior(CommandBehavior.SingleRow) && _position != StartPosition) { return(false); } else { using (var explicitCancellation = ExplicitCancellation.Enter(cancellationToken, _command.Cancel)) { _row = await _command.FetchAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); if (_row != null) { _position++; return(true); } else { _eof = true; return(false); } } } }
public override bool Read() { CheckState(); if (IsCommandBehavior(CommandBehavior.SchemaOnly)) { return(false); } else if (IsCommandBehavior(CommandBehavior.SingleRow) && _position != StartPosition) { return(false); } else { using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, _command.Cancel)) { _row = _command.Fetch(); if (_row != null) { _position++; return(true); } else { _eof = true; return(false); } } } }
public void Prepare() { CheckCommand(); using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, Cancel)) { try { Prepare(false); } catch (IscException ex) { RollbackImplicitTransaction(); throw FbException.Create(ex); } catch { RollbackImplicitTransaction(); throw; } } }
public async Task PrepareAsync(CancellationToken cancellationToken = default) { CheckCommand(); using (var explicitCancellation = ExplicitCancellation.Enter(cancellationToken, Cancel)) { try { await PrepareAsync(false, explicitCancellation.CancellationToken).ConfigureAwait(false); } catch (IscException ex) { await RollbackImplicitTransactionAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); throw FbException.Create(ex); } catch { await RollbackImplicitTransactionAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); throw; } } }