Skip to content

Commit

Permalink
throw for bad chi
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Jul 17, 2024
1 parent ed0da23 commit 0539bae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
32 changes: 16 additions & 16 deletions SCIStorePlugin/Attachers/SciStoreAttacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,22 @@ private void BulkInsertDataTable(DataTable dataTable, IDataLoadJob job)

var tbl = _dbInfo.ExpectTable(dataTable.TableName);
using var blk = tbl.BeginBulkInsert();
DataTable ndt = dataTable.Clone();
foreach (var row in dataTable.Rows)
{
try
{
ndt = dataTable.Clone();
ndt.Rows.Add(row);
blk.Upload(ndt);
}
catch (Exception e)
{
job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
$"Skipped a row due to error: {e.Message}.", e));
}
}
//blk.Upload(dataTable);
//DataTable ndt = dataTable.Clone();
//foreach (var row in dataTable.Rows)
//{
// try
// {
// ndt = dataTable.Clone();
// ndt.Rows.Add(row);
// blk.Upload(ndt);
// }
// catch (Exception e)
// {
// job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
// $"Skipped a row due to error: {e.Message}.", e));
// }
//}
blk.Upload(dataTable);
}

public bool SilentRunning { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion SCIStorePlugin/Data/SciStoreHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ private static string CleanCHI(string chi)
// encountered in Fife Haematology load
if (!string.IsNullOrWhiteSpace(chi) && chi.Equals("Temp Residen"))
return chi[..10];

if (chi.Length > 10)
throw new Exception($"CHI '{chi}' was too long");
return chi;
}

Expand Down

0 comments on commit 0539bae

Please sign in to comment.