Close closes the batch operation. Any error that occurred during a batch operation may have made it impossible to resyncronize the connection with the server. In this case the underlying connection will have been closed.
()
| 393 | // Close closes the batch operation. Any error that occurred during a batch operation may have made it impossible to |
| 394 | // resyncronize the connection with the server. In this case the underlying connection will have been closed. |
| 395 | func (br *pipelineBatchResults) Close() error { |
| 396 | defer func() { |
| 397 | if !br.endTraced { |
| 398 | if br.conn.batchTracer != nil { |
| 399 | br.conn.batchTracer.TraceBatchEnd(br.ctx, br.conn, TraceBatchEndData{Err: br.err}) |
| 400 | } |
| 401 | br.endTraced = true |
| 402 | } |
| 403 | |
| 404 | invalidateCachesOnBatchResultsError(br.conn, br.b, br.err) |
| 405 | }() |
| 406 | |
| 407 | if br.err == nil && br.lastRows != nil && br.lastRows.err != nil { |
| 408 | br.err = br.lastRows.err |
| 409 | } |
| 410 | |
| 411 | if br.closed { |
| 412 | return br.err |
| 413 | } |
| 414 | |
| 415 | // Read and run fn for all remaining items |
| 416 | for br.err == nil && !br.closed && br.b != nil && br.qqIdx < len(br.b.QueuedQueries) { |
| 417 | if br.b.QueuedQueries[br.qqIdx].Fn != nil { |
| 418 | err := br.b.QueuedQueries[br.qqIdx].Fn(br) |
| 419 | if err != nil { |
| 420 | br.err = err |
| 421 | } |
| 422 | } else { |
| 423 | br.Exec() |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | br.closed = true |
| 428 | |
| 429 | err := br.pipeline.Close() |
| 430 | if br.err == nil { |
| 431 | br.err = err |
| 432 | } |
| 433 | |
| 434 | return br.err |
| 435 | } |
| 436 | |
| 437 | func (br *pipelineBatchResults) earlyError() error { |
| 438 | return br.err |
nothing calls this directly
no test coverage detected