public async Task UpdateJobHistoryEntryVetoed( IJobExecutionContext context, CancellationToken cancellationToken = default(CancellationToken)) { string sql = AdoJobStoreUtil.ReplaceTablePrefix(PropertySqlUpdateHistoryVetoed, _tablePrefix, null); using (ConnectionAndTransactionHolder connection = GetConnection(IsolationLevel.ReadUncommitted)) { using (DbCommand command = Delegate.PrepareCommand(connection, sql)) { Delegate.AddCommandParameter(command, "vetoed", true); Delegate.AddCommandParameter(command, "fireInstanceId", context.FireInstanceId); await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false); connection.Commit(false); } } }
public async Task UpdateJobHistoryEntryError( IJobExecutionContext context, JobExecutionException jobException, CancellationToken cancellationToken = default(CancellationToken)) { string sql = AdoJobStoreUtil.ReplaceTablePrefix(PropertySqlUpdateHistoryError, _tablePrefix, null); using (ConnectionAndTransactionHolder connection = GetConnection(IsolationLevel.ReadUncommitted)) { using (DbCommand command = Delegate.PrepareCommand(connection, sql)) { Delegate.AddCommandParameter(command, "error", Delegate.GetDbBooleanValue(jobException != null)); Delegate.AddCommandParameter(command, "errorMessage", jobException?.GetBaseException()?.Message); Delegate.AddCommandParameter(command, "fireInstanceId", context.FireInstanceId); await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false); connection.Commit(false); } } }
public async Task CreateJobHistoryEntry( IJobExecutionContext context, CancellationToken cancellationToken = default(CancellationToken)) { string sql = AdoJobStoreUtil.ReplaceTablePrefix(PropertySqlInsertJobExecuted, _tablePrefix, null); using (ConnectionAndTransactionHolder connection = GetConnection(IsolationLevel.ReadUncommitted)) { using (DbCommand command = Delegate.PrepareCommand(connection, sql)) { Delegate.AddCommandParameter(command, "schedulerName", context.Scheduler.SchedulerName); Delegate.AddCommandParameter(command, "schedulerInstanceName", context.Scheduler.SchedulerInstanceId); Delegate.AddCommandParameter(command, "jobName", context.JobDetail.Key.Name); Delegate.AddCommandParameter(command, "jobGroup", context.JobDetail.Key.Group); Delegate.AddCommandParameter(command, "triggerName", context.Trigger.Key.Name); Delegate.AddCommandParameter(command, "triggerGroup", context.Trigger.Key.Group); Delegate.AddCommandParameter(command, "scheduledTime", Delegate.GetDbDateTimeValue(context.ScheduledFireTimeUtc)); Delegate.AddCommandParameter(command, "firedTime", Delegate.GetDbDateTimeValue(context.FireTimeUtc)); Delegate.AddCommandParameter(command, "runTime", Delegate.GetDbTimeSpanValue(context.JobRunTime)); Delegate.AddCommandParameter(command, "fireInstanceId", context.FireInstanceId); Delegate.AddCommandParameter(command, "scheduledFireTimeUtc", context.ScheduledFireTimeUtc?.UtcDateTime); Delegate.AddCommandParameter(command, "actualFireTimeUtc", context.FireTimeUtc.UtcDateTime); Delegate.AddCommandParameter(command, "finishedTimeUtc", DateTime.UtcNow); Delegate.AddCommandParameter(command, "recovering", context.Recovering); Delegate.AddCommandParameter(command, "vetoed", false); Delegate.AddCommandParameter(command, "error", false); try { await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false); connection.Commit(false); } catch (Exception ex) { throw ex; } } } }