Mercurial > gemma
changeset 2780:5850ac0f9ab6
Axis import: do not fail if one item fails.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 22 Mar 2019 14:20:08 +0100 |
parents | 21eb85cdfe45 |
children | a2127495093e |
files | pkg/imports/wx.go |
diffstat | 1 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/wx.go Fri Mar 22 13:26:24 2019 +0100 +++ b/pkg/imports/wx.go Fri Mar 22 14:20:08 2019 +0100 @@ -214,6 +214,8 @@ feedback.Info("Using EPSG: %d", epsg) + savepoint := Savepoint(ctx, tx, "feature") + for _, feature := range rfc.Features { if feature.Properties == nil || feature.Geometry.Coordinates == nil { missingProperties++ @@ -240,7 +242,7 @@ } if err := storeLinestring( ctx, - tx, + savepoint, feedback, l, epsg, @@ -259,7 +261,7 @@ for _, l := range ls { if err := storeLinestring( ctx, - tx, + savepoint, feedback, l, epsg, @@ -308,7 +310,7 @@ func storeLinestring( ctx context.Context, - tx *sql.Tx, + savepoint func(func() error) error, feedback Feedback, l lineSlice, epsg int, @@ -317,14 +319,17 @@ checkCrossingStmt, insertStmt *sql.Stmt, ) error { var id int - if err := insertStmt.QueryRowContext( - ctx, - l.asWKB(), - epsg, - props.ObjNam, - nobjnam, - ).Scan(&id); err != nil { + if err := savepoint(func() error { + err := insertStmt.QueryRowContext( + ctx, + l.asWKB(), + epsg, + props.ObjNam, + nobjnam, + ).Scan(&id) return err + }); err != nil { + feedback.Warn(handleError(err).Error()) } var crossing string