예제 #1
0
        private async Task <bool> ReadImpl(AsyncWrappingCommonArgs async)
        {
            CheckState();

            var retValue = false;

            if (IsCommandBehavior(CommandBehavior.SingleRow) && _position != StartPosition)
            {
            }
            else
            {
                if (IsCommandBehavior(CommandBehavior.SchemaOnly))
                {
                }
                else
                {
                    using (async.EnterExplicitCancel(_command.Cancel))
                    {
                        _row = await _command.Fetch(async).ConfigureAwait(false);

                        if (_row != null)
                        {
                            _position++;
                            retValue = true;
                        }
                        else
                        {
                            _eof = true;
                        }
                    }
                }
            }

            return(retValue);
        }
        internal async Task <int> ExecuteNonQueryImpl(AsyncWrappingCommonArgs async)
        {
            CheckCommand();

            try
            {
                using (async.EnterExplicitCancel(Cancel))
                {
                    await ExecuteCommand(CommandBehavior.Default, false, async).ConfigureAwait(false);

                    if (_statement.StatementType == DbStatementType.StoredProcedure)
                    {
                        await SetOutputParameters(async).ConfigureAwait(false);
                    }

                    await CommitImplicitTransaction(async).ConfigureAwait(false);
                }
            }
            catch (IscException ex)
            {
                await RollbackImplicitTransaction(async).ConfigureAwait(false);

                throw FbException.Create(ex);
            }
            catch
            {
                await RollbackImplicitTransaction(async).ConfigureAwait(false);

                throw;
            }

            return(_statement.StatementType switch
            {
                DbStatementType.Insert => RecordsAffected,
                DbStatementType.Update => RecordsAffected,
                DbStatementType.Delete => RecordsAffected,
                _ => - 1,
            });
        internal async Task PrepareImpl(AsyncWrappingCommonArgs async)
        {
            CheckCommand();

            try
            {
                using (async.EnterExplicitCancel(Cancel))
                {
                    await Prepare(false, async).ConfigureAwait(false);
                }
            }
            catch (IscException ex)
            {
                await RollbackImplicitTransaction(async).ConfigureAwait(false);

                throw FbException.Create(ex);
            }
            catch
            {
                await RollbackImplicitTransaction(async).ConfigureAwait(false);

                throw;
            }
        }