Skip to content

Commit

Permalink
mazak: small changes to open database kit
Browse files Browse the repository at this point in the history
  • Loading branch information
wuzzeb committed Sep 10, 2024
1 parent ad884a5 commit 64150d7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/machines/mazak/db/OpenDatabaseKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ private bool CheckPartsExist(IList<string> parts)
return WithReadDBConnection(conn =>
{
using var trans = conn.BeginTransaction();
var cmd = conn.CreateCommand();
using var cmd = conn.CreateCommand();
cmd.Transaction = trans;
cmd.CommandText = "SELECT COUNT(*) FROM Part WHERE PartName = @p";
var param = cmd.CreateParameter();
Expand All @@ -1244,7 +1244,7 @@ private bool CheckPartsExist(IList<string> parts)
foreach (var p in parts)
{
param.Value = p;

Check warning on line 1246 in server/machines/mazak/db/OpenDatabaseKit.cs

View check run for this annotation

Codecov / codecov/patch

server/machines/mazak/db/OpenDatabaseKit.cs#L1245-L1246

Added lines #L1245 - L1246 were not covered by tests
if ((int)cmd.ExecuteScalar() == 0)
if ((long)cmd.ExecuteScalar() == 0)
{
return false;
}
Expand All @@ -1262,7 +1262,7 @@ private bool CheckSchedulesExist(IList<int> scheduleIds)
return WithReadDBConnection(conn =>
{
using var trans = conn.BeginTransaction();
var cmd = conn.CreateCommand();
using var cmd = conn.CreateCommand();
cmd.Transaction = trans;

cmd.CommandText = "SELECT COUNT(*) FROM Schedule WHERE ScheduleID = @s";
Expand All @@ -1274,7 +1274,7 @@ private bool CheckSchedulesExist(IList<int> scheduleIds)
foreach (var s in scheduleIds)
{
param.Value = s;

Check warning on line 1276 in server/machines/mazak/db/OpenDatabaseKit.cs

View check run for this annotation

Codecov / codecov/patch

server/machines/mazak/db/OpenDatabaseKit.cs#L1275-L1276

Added lines #L1275 - L1276 were not covered by tests
if ((int)cmd.ExecuteScalar() == 0)
if ((long)cmd.ExecuteScalar() == 0)
{
return false;
}
Expand Down Expand Up @@ -1311,6 +1311,7 @@ public MazakAllDataAndLogs LoadAllDataAndLogs(string maxLogID)
}
else

Check warning on line 1312 in server/machines/mazak/db/OpenDatabaseKit.cs

View check run for this annotation

Codecov / codecov/patch

server/machines/mazak/db/OpenDatabaseKit.cs#L1309-L1312

Added lines #L1309 - L1312 were not covered by tests
{
trans.Rollback();
logs = LogCSVParsing.LoadLog(maxLogID, _cfg.LogCSVPath);

Check warning on line 1315 in server/machines/mazak/db/OpenDatabaseKit.cs

View check run for this annotation

Codecov / codecov/patch

server/machines/mazak/db/OpenDatabaseKit.cs#L1314-L1315

Added lines #L1314 - L1315 were not covered by tests
}

Expand Down

0 comments on commit 64150d7

Please sign in to comment.