| | |
| | | using System; |
| | | using DataLoader.Model; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data.Common; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace DataLoader.CS |
| | | { |
| | | /// <summary> |
| | | /// 元数据帮助类 |
| | | /// </summary> |
| | | 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"; |
| | | |
| | | /// <summary> |
| | | /// 插入数据 |
| | | /// </summary> |
| | | public int Insert(List<SysMeta> list) |
| | | { |
| | | PostgreHelper db = Tools.DBHelper; |
| | | |
| | | int count = 0; |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | List<DbParameter> args = Tools.GetParams<SysMeta>(insertSql, meta) |
| | | ; |
| | | int id = db.GetIntScalar(insertSql, args.ToArray()); |
| | | if (id > 0) count++; |
| | | } |
| | | |
| | | return count; |
| | | } |
| | | } |
| | | } |