(sql string, pipePath string)
| 254 | b.WriteString(")") |
| 255 | |
| 256 | return b.String() |
| 257 | } |
| 258 | |
| 259 | func (loader *CsvDataLoader) executeCopy(sql string, pipePath string) { |
| 260 | defer close(loader.rowCount) |
| 261 | loader.logger.Debugf("Executing COPY statement: %s", sql) |
| 262 | result, err := adapter.Exec(loader.ctx, sql) |
| 263 | if err != nil { |
| 264 | loader.ctx.GetLogger().Error(err) |
| 265 | loader.err.Store(&err) |
| 266 | if loader.blocked.Load() { |
| 267 | // Open the pipe once to unblock the writer |
| 268 | pipe, _ := os.OpenFile(pipePath, os.O_RDONLY, os.ModeNamedPipe) |
| 269 | loader.errPipe.Store(pipe) |
| 270 | } |
| 271 | return |
| 272 | } |
| 273 | |
| 274 | rows, err := result.RowsAffected() |
| 275 | if err != nil { |
| 276 | loader.ctx.GetLogger().Error(err) |
| 277 | loader.err.Store(&err) |
| 278 | return |
| 279 | } |
| 280 | loader.rowCount <- rows |
| 281 | } |
no test coverage detected