QueryRow assumes there will be only one row, and closes the underlying Connection right after Scan.
So don't be lazy, and use Query, and the returned Rows if you need to use the database connection after Scan.
I wanted to share this hard learned lesson suffered during debugging https://github.com/tgulacsi/goracle/issues/26.
On Friday, February 6, 2015 at 7:48:07 PM UTC+1, Tamás Gulácsi wrote:QueryRow assumes there will be only one row, and closes the underlying Connection right after Scan.
So don't be lazy, and use Query, and the returned Rows if you need to use the database connection after Scan.This advice seems confused. The connection is not closed; it's merely returned back to the pool. But the more important point is that that shouldn't matter.
I wanted to share this hard learned lesson suffered during debugging https://github.com/tgulacsi/goracle/issues/26.
Looks like oracle.ExternalLobVar is abusing the interface provided by database/sql. In this case I think using Query is safe (though don't quote me on that since I didn't spend too much time thinking about it), but it's still an ugly workaround.
QueryRow is fine, even though it might not work with all types of abuse the database/sql API can take.
.m