Ejemplo n.º 1
0
 /// <summary>
 /// Emits the current batch.
 /// </summary>
 /// <param name="batch">The batch.</param>
 private void ProcessBatch(ProcessorContext processorContext, string batch)
 {
     m_processor.ProcessProgress(processorContext, "Executing batch " + processorContext.CurrentBatchNo);
     Debug.WriteLineIf(GlobalSettings.Verbosity.TraceVerbose, batch);
     try {
         m_processor.ProcessBatch(processorContext, batch);
     }
     catch (Sqt.DbcProvider.WrappedDbException ex) {
         ++m_errorCount;
         string message = FormatError(processorContext, TraceLevel.Error, ex.Message, ex.LineNumber);
         Trace.WriteLineIf(GlobalSettings.Verbosity.TraceError, message);
         if (m_options.BreakOnError)
         {
             throw new TerminateException(ExitCode.SqlCommandError);
         }
     }
     catch (System.Data.SqlClient.SqlException ex) {
         ++m_errorCount;
         string message = FormatError(processorContext, TraceLevel.Error, ex.Message, ex.LineNumber);
         Trace.WriteLineIf(GlobalSettings.Verbosity.TraceError, message);
         if (m_options.BreakOnError)
         {
             throw new TerminateException(ExitCode.SqlCommandError);
         }
     }
     catch (System.Data.Common.DbException ex) {
         ++m_errorCount;
         string message = FormatError(processorContext, TraceLevel.Error, ex.Message, 0);
         Trace.WriteLineIf(GlobalSettings.Verbosity.TraceError, message);
         if (m_options.BreakOnError)
         {
             throw new TerminateException(ExitCode.SqlCommandError);
         }
     }
 }