Retrieve the `current_database` for a connection, or `None` if the session does not exist or has not had a database bound yet.
(&self, addr: &SocketAddr)
| 112 | /// Retrieve the `current_database` for a connection, or `None` if the session |
| 113 | /// does not exist or has not had a database bound yet. |
| 114 | pub fn get_current_database(&self, addr: &SocketAddr) -> Option<DatabaseId> { |
| 115 | let sessions = self.sessions.read().unwrap_or_else(|p| p.into_inner()); |
| 116 | sessions.get(addr)?.current_database |
| 117 | } |
| 118 | |
| 119 | /// Bind a database to a session. Called at pgwire startup once the database |
| 120 | /// name from the StartupMessage has been resolved to a `DatabaseId`. |
no test coverage detected