Skip to content

Commit 0c8ada8

Browse files
committed
Add option to stop on error
1 parent c61e1ba commit 0c8ada8

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

BigSQLRunnerUI/frmMainUI.Designer.cs

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BigSQLRunnerUI/frmMainUI.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public partial class frmMainUI : Form
1313
{
1414
private bool AllowToRun;
1515
private string CurrentFile;
16+
private bool StopOnError;
1617
Stopwatch swTotalTime;
1718

1819
public frmMainUI()
@@ -94,6 +95,7 @@ private void btnRunScript_Click(object sender, EventArgs e)
9495
ControlScreen(false);
9596

9697
AllowToRun = true;
98+
StopOnError = chkStopOnError.Checked;
9799

98100
foreach (var item in lstFiles.Items)
99101
{
@@ -225,6 +227,7 @@ public void ControlScreen(bool bEnable)
225227
lstFiles.Enabled = bEnable;
226228
txtLinesPerBatch.Enabled = bEnable;
227229
txtStartingLine.Enabled = bEnable;
230+
chkStopOnError.Enabled = bEnable;
228231
btnStop.Enabled = !bEnable;
229232
Cursor.Current = bEnable ? Cursors.Default : Cursors.WaitCursor;
230233
this.UseWaitCursor = !bEnable;
@@ -307,6 +310,8 @@ private bool RunScript(string sourceScript, string connectionString, short qtyMa
307310
File.AppendAllText(errorFile, sb.ToString() + Environment.NewLine);
308311
File.AppendAllText(errorFile, errormsg + Environment.NewLine);
309312
qtyErrorLines++;
313+
if (StopOnError)
314+
AllowToRun = false;
310315
}
311316
control = 0;
312317
sb.Clear();
@@ -346,6 +351,8 @@ private bool RunScript(string sourceScript, string connectionString, short qtyMa
346351
File.AppendAllText(errorFile, sb.ToString() + Environment.NewLine);
347352
File.AppendAllText(errorFile, errormsg + Environment.NewLine);
348353
qtyErrorLines++;
354+
if (StopOnError)
355+
AllowToRun = false;
349356
}
350357
control = 0;
351358
sb.Clear();

0 commit comments

Comments
 (0)