Close closes the PooledTableSession, releasing it back to the pool. Returns: - err: An error if there is an issue with session closure or cleanup.
()
| 172 | // Returns: |
| 173 | // - err: An error if there is an issue with session closure or cleanup. |
| 174 | func (s *PooledTableSession) Close() error { |
| 175 | if atomic.CompareAndSwapInt32(&s.closed, 0, 1) { |
| 176 | if s.session.config.Database != s.sessionPool.config.Database && s.sessionPool.config.Database != "" { |
| 177 | err := s.session.ExecuteNonQueryStatement("use " + s.sessionPool.config.Database) |
| 178 | if err != nil { |
| 179 | log.Println("Failed to change back database by executing: use ", s.sessionPool.config.Database) |
| 180 | s.sessionPool.dropSession(s.session) |
| 181 | s.session = Session{} |
| 182 | return nil |
| 183 | } |
| 184 | } |
| 185 | s.sessionPool.PutBack(s.session) |
| 186 | s.session = Session{} |
| 187 | } |
| 188 | return nil |
| 189 | } |
nothing calls this directly
no test coverage detected