2
0

Fix batch query with query syntax error

This commit is contained in:
Jack Christensen
2017-07-21 15:22:32 -05:00
parent dde965bc9d
commit 79517aaa0e
2 changed files with 43 additions and 6 deletions
+9 -6
View File
@@ -167,25 +167,28 @@ func (b *Batch) ExecResults() (CommandTag, error) {
// QueryResults reads the results from the next query in the batch as if the
// query has been sent with Query.
func (b *Batch) QueryResults() (*Rows, error) {
rows := b.conn.getRows("batch query", nil)
if b.err != nil {
return nil, b.err
rows.fatal(b.err)
return rows, b.err
}
select {
case <-b.ctx.Done():
b.die(b.ctx.Err())
return nil, b.ctx.Err()
rows.fatal(b.err)
return rows, b.ctx.Err()
default:
}
b.resultsRead++
rows := b.conn.getRows("batch query", nil)
fieldDescriptions, err := b.conn.readUntilRowDescription()
if err != nil {
b.die(b.ctx.Err())
return nil, err
b.die(err)
rows.fatal(b.err)
return rows, err
}
rows.batch = b