Beispiel #1
0
        public void Execute(ISqlCommandSimple command, IExecutionContext context, int index)
        {
            context.StartSetupCommand(index);
            using var dbCommand = context.CreateCommand();
            if (!SetupCommand(command, dbCommand))
            {
                context.MarkAborted();
                return;
            }

            try
            {
                context.StartExecute(index, dbCommand);
                dbCommand.Command.ExecuteNonQuery();
            }
            catch (SqlQueryException)
            {
                context.MarkAborted();
                throw;
            }
            catch (Exception e)
            {
                context.MarkAborted();
                var sql = context.Stringifier.Stringify(dbCommand);
                throw SqlQueryException.Wrap(e, sql, index);
            }
        }
 public void Execute(ISqlConnectionAccessor accessor, IExecutionContext context, int index)
 {
     try
     {
         accessor.Execute(context.Connection.Connection, context.Transaction);
     }
     catch (SqlQueryException)
     {
         context.MarkAborted();
         throw;
     }
     catch (Exception e)
     {
         context.MarkAborted();
         // We can't do anything fancy with error handling, because we don't know what the user
         // is trying to do
         throw SqlQueryException.Wrap(e, null, index);
     }
 }