Mercurial > gemma
comparison pkg/imports/st.go @ 2231:97bba8b51b9c
Stretch import: Be more verbose about range before inserting data.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 13 Feb 2019 11:13:06 +0100 |
parents | 7c83b5277c1c |
children | cce158db02b0 |
comparison
equal
deleted
inserted
replaced
2230:4374d942b23d | 2231:97bba8b51b9c |
---|---|
168 var nobjnm sql.NullString | 168 var nobjnm sql.NullString |
169 if st.NObjNam != nil { | 169 if st.NObjNam != nil { |
170 nobjnm = sql.NullString{String: *st.NObjNam, Valid: true} | 170 nobjnm = sql.NullString{String: *st.NObjNam, Valid: true} |
171 } | 171 } |
172 | 172 |
173 feedback.Info("Stretch from %s to %s.", st.From, st.To) | |
174 | |
173 var id int64 | 175 var id int64 |
174 if err := tx.QueryRowContext( | 176 if err := tx.QueryRowContext( |
175 ctx, | 177 ctx, |
176 stInsertSQL, | 178 stInsertSQL, |
177 st.From.CountryCode, | 179 st.From.CountryCode, |
192 ).Scan(&id); err != nil { | 194 ).Scan(&id); err != nil { |
193 return nil, err | 195 return nil, err |
194 } | 196 } |
195 | 197 |
196 // store the associated countries. | 198 // store the associated countries. |
199 | |
200 feedback.Info("Countries associated with stretch: %s.", st.Countries) | |
197 for _, c := range st.Countries { | 201 for _, c := range st.Countries { |
198 if _, err := insertCountryStmt.ExecContext(ctx, id, c); err != nil { | 202 if _, err := insertCountryStmt.ExecContext(ctx, id, c); err != nil { |
199 return nil, err | 203 return nil, err |
200 } | 204 } |
201 } | 205 } |