using DataLoader.Model; using System; using System.Collections.Generic; using System.Data.Common; using System.Linq; namespace DataLoader.CS { /// /// 元数据帮助类 /// public class MetaHelper { // id, eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, update_user, update_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct public static string insertSql = "insert into lf.sys_meta (eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct) values (@eventid, @metaid, @verid, @name, @type, @guid, @path, @sizes, @tab, @rows, @create_user, now(), @bak, @geom, @layer, @depcode, @dircode, @ismeta, @sensortype, @acq_time, @resolution, @gridsize, @coor_sys, @epsg, @h_datum, @mata_type, @bands, @band_type, @ct) returning id"; /// /// 插入数据 /// public int Insert(List list) { PostgreHelper db = Tools.DBHelper; int count = 0; foreach (SysMeta meta in list) { List args = Tools.GetParams(insertSql, meta) ; int id = db.GetIntScalar(insertSql, args.ToArray()); if (id > 0) count++; } return count; } } }