From 86b2f29676c52774d91dda96e0ba5d4d7bcd3b47 Mon Sep 17 00:00:00 2001 From: Daniel Theophanes Date: Thu, 6 Oct 2016 11:06:21 -0700 Subject: database/sql: add support for multiple result sets Many database systems allow returning multiple result sets in a single query. This can be useful when dealing with many intermediate results on the server and there is a need to return more then one arity of data to the client. Fixes #12382 Change-Id: I480a9ac6dadfc8743e0ba8b6d868ccf8442a9ca1 Reviewed-on: https://go-review.googlesource.com/30592 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/database/sql/driver/driver.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/database/sql/driver') diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go index ccc283d373..b3d83f3ff4 100644 --- a/src/database/sql/driver/driver.go +++ b/src/database/sql/driver/driver.go @@ -213,6 +213,22 @@ type Rows interface { Next(dest []Value) error } +// RowsNextResultSet extends the Rows interface by providing a way to signal +// the driver to advance to the next result set. +type RowsNextResultSet interface { + Rows + + // HasNextResultSet is called at the end of the current result set and + // reports whether there is another result set after the current one. + HasNextResultSet() bool + + // NextResultSet advances the driver to the next result set even + // if there are remaining rows in the current result set. + // + // NextResultSet should return io.EOF when there are no more result sets. + NextResultSet() error +} + // Tx is a transaction. type Tx interface { Commit() error -- cgit v1.3