개정판 f4485671
dev issue #1203 : Symbol Mapping Query 전부 완료
Change-Id: Ib48cc90e489f3d1df7b94fe2089407b95d251436
DTI_PID/SPPIDConverter/DB/Project_DB.cs | ||
---|---|---|
392 | 392 |
foreach (var item in dicSetting) |
393 | 393 |
{ |
394 | 394 |
cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString, @SettingType)", SPPID_SETTING_TABLE); |
395 |
cmd.Parameters.Clear(); |
|
395 | 396 |
cmd.Parameters.AddWithValue("@jsonString", item.Value); |
396 | 397 |
cmd.Parameters.AddWithValue("@SettingType", item.Key); |
397 | 398 |
cmd.ExecuteNonQuery(); |
... | ... | |
425 | 426 |
foreach (var item in dicSetting) |
426 | 427 |
{ |
427 | 428 |
cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString, @SettingType)", SPPID_SETTING_TABLE); |
429 |
cmd.Parameters.Clear(); |
|
428 | 430 |
cmd.Parameters.AddWithValue("@jsonString", item.Value); |
429 | 431 |
cmd.Parameters.AddWithValue("@SettingType", item.Key); |
430 | 432 |
cmd.ExecuteNonQuery(); |
... | ... | |
1389 | 1391 |
ELSE |
1390 | 1392 |
INSERT INTO {0} (UID, NAME, SPPID_SYMBOL_PATH, LEADERLINE) VALUES (@UID, @NAME, @SPPID_SYMBOL_PATH, @LEADERLINE)", SPPID_SYMBOL_MAPPING_TABLE, item.Item1); |
1391 | 1393 |
cmd.Parameters.AddWithValue("@UID", item.Item1); |
1392 |
cmd.Parameters.AddWithValue("@NAME", item.Item2); |
|
1394 |
if (string.IsNullOrEmpty(item.Item2)) |
|
1395 |
cmd.Parameters.AddWithValue("@NAME", DBNull.Value); |
|
1396 |
else |
|
1397 |
cmd.Parameters.AddWithValue("@NAME", item.Item2); |
|
1393 | 1398 |
if (string.IsNullOrEmpty(item.Item3)) |
1394 | 1399 |
cmd.Parameters.AddWithValue("@SPPID_SYMBOL_PATH", DBNull.Value); |
1395 | 1400 |
else |
... | ... | |
1472 | 1477 |
{ |
1473 | 1478 |
if (connection != null && connection.State == ConnectionState.Open) |
1474 | 1479 |
{ |
1475 |
using (SqlTransaction transaction = connection.BeginTransaction())
|
|
1480 |
using (SqlCommand cmd = connection.CreateCommand())
|
|
1476 | 1481 |
{ |
1477 |
using (SqlCommand cmd = connection.CreateCommand())
|
|
1482 |
foreach (var item in datas)
|
|
1478 | 1483 |
{ |
1479 |
foreach (var item in datas) |
|
1480 |
{ |
|
1481 |
cmd.Parameters.Clear(); |
|
1482 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (UID, SPPID_ATTRIBUTE) VALUES (@UID, @SPPID_ATTRIBUTE)", SPPID_ATTRIBUTE_MAPPING_TABLE); |
|
1483 |
cmd.Parameters.AddWithValue("@UID", item.Item1); |
|
1484 |
cmd.Parameters.Clear(); |
|
1485 |
cmd.CommandText = string.Format(@" |
|
1486 |
IF EXISTS (SELECT * FROM {0} WHERE UID = '{1}') |
|
1487 |
UPDATE {0} SET SPPID_ATTRIBUTE = @SPPID_ATTRIBUTE WHERE UID = @UID |
|
1488 |
ELSE |
|
1489 |
INSERT INTO {0} (UID, SPPID_ATTRIBUTE) VALUES (@UID, @SPPID_ATTRIBUTE)", SPPID_ATTRIBUTE_MAPPING_TABLE, item.Item1); |
|
1490 |
|
|
1491 |
cmd.Parameters.AddWithValue("@UID", item.Item1); |
|
1492 |
if (string.IsNullOrEmpty(item.Item2)) |
|
1493 |
cmd.Parameters.AddWithValue("@SPPID_ATTRIBUTE", DBNull.Value); |
|
1494 |
else |
|
1484 | 1495 |
cmd.Parameters.AddWithValue("@SPPID_ATTRIBUTE", item.Item2); |
1485 |
cmd.ExecuteNonQuery(); |
|
1486 |
} |
|
1496 |
cmd.ExecuteNonQuery(); |
|
1487 | 1497 |
} |
1488 |
connection.Close(); |
|
1489 | 1498 |
} |
1499 |
connection.Close(); |
|
1490 | 1500 |
} |
1491 | 1501 |
} |
1492 | 1502 |
catch (Exception ex) |
... | ... | |
1566 | 1576 |
foreach (var item in datas) |
1567 | 1577 |
{ |
1568 | 1578 |
cmd.Parameters.Clear(); |
1569 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (UID, LOCATION, LEADERLINE) VALUES (@UID, @LOCATION, @LEADERLINE)", SPPID_LABEL_INFO_TABLE); |
|
1579 |
cmd.CommandText = string.Format(@" |
|
1580 |
IF EXISTS (SELECT * FROM {0} WHERE UID = '{1}') |
|
1581 |
UPDATE {0} SET LOCATION = @LOCATION, LEADERLINE = @LEADERLINE WHERE UID = @UID |
|
1582 |
ELSE |
|
1583 |
INSERT INTO {0} (UID, LOCATION, LEADERLINE) VALUES (@UID, @LOCATION, @LEADERLINE)", SPPID_LABEL_INFO_TABLE, item.Item1); |
|
1584 |
|
|
1570 | 1585 |
cmd.Parameters.AddWithValue("@UID", item.Item1); |
1571 | 1586 |
cmd.Parameters.AddWithValue("@LOCATION", item.Item2); |
1572 | 1587 |
cmd.Parameters.AddWithValue("@LEADERLINE", item.Item3); |
내보내기 Unified diff