[後端] 修改sql execute over time problem

This commit is contained in:
dev02 2023-11-14 12:20:04 +08:00
parent 4283fb94ba
commit 9ad73b749b

View File

@ -271,11 +271,28 @@ namespace Repository.BackendRepository.Implement
row.full_name + "'," + row.full_name + "'," +
"0" + "0" +
");"); ");");
if (sb.Length >= 100)
{
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
await conn.ExecuteAsync(sb.ToString());
}
sb.Clear();
}
} }
var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';"); var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
if (sb.Length > 0) if (sb.Length > 0)
{ {
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
await conn.ExecuteAsync(sb.ToString());
}
sb.Clear();
if (isDome.Contains("ibms_dome")) if (isDome.Contains("ibms_dome"))
{ {
sb.Append($@" update import_niagara_item a sb.Append($@" update import_niagara_item a
@ -283,8 +300,15 @@ namespace Repository.BackendRepository.Implement
join variable v1 on b.system_parent_id = v1.id join variable v1 on b.system_parent_id = v1.id
set device_system_tag = v1.system_value set device_system_tag = v1.system_value
where (device_system_tag <> 'S' and device_system_tag <> 'CWB' and device_system_tag <> 'B');"); where (device_system_tag <> 'S' and device_system_tag <> 'CWB' and device_system_tag <> 'B');");
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
await conn.ExecuteAsync(sb.ToString());
}
} }
sb.Clear();
sb.Append($@" update import_niagara_item set full_name = device_point_name where full_name = '' or full_name is null;"); sb.Append($@" update import_niagara_item set full_name = device_point_name where full_name = '' or full_name is null;");
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{ {