Closed mopo3ilo closed 2 years ago
What's the problem with that? From the CL that added it:
Most sessions have a way to reset the session state which is desirable to prevent one bad query from poisoning another later query with temp table name conflicts or other persistent session resources.
What's the problem with that? From the CL that added it:
Example: Parallel gorutines, in each first Exec create temporary tables, next execs use this tables and update data in db
That;s not safe, use DB.Conn
if you need sessions
If error == nil then the needReset set true and each db.Exec reseted session
https://github.com/golang/go/blob/bf88adadac9bbb1b190ba7af1010373823dabb06/src/database/sql/sql.go#L528-L530
https://github.com/golang/go/blob/bf88adadac9bbb1b190ba7af1010373823dabb06/src/database/sql/sql.go#L1445-L1450