public void Save(List <Tag> NewTagList) { List <String> sqlList = new List <string>(); foreach (Tag tag in NewTagList) { Tag oldTag = FindByTagName(tag.Name); if (oldTag == null) { sqlList.Add("insert into tag(name) values('" + tag.Name + "')"); } } m_SqliteOpera.BatProcess(sqlList); }
public void Save(List <HostTag> HostTagList) { List <String> sqlList = new List <string>(); String sqlBasicTag = "insert into host_tag(host_id,tag_id) values"; StringBuilder sbuilder = new StringBuilder(sqlBasicTag); foreach (HostTag ht in HostTagList) { sbuilder.AppendFormat("({0},{1})", ht.HostId, ht.TagId); sqlList.Add(sbuilder.ToString()); sbuilder = new StringBuilder(sqlBasicTag); } m_SqliteOpera.BatProcess(sqlList); }