MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / get_current_database

Method get_current_database

nodedb/src/control/server/pgwire/session/store.rs:114–117  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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`.

Callers 10

handle_explainMethod · 0.80
execute_single_sqlMethod · 0.80
do_queryMethod · 0.80
handle_sqlFunction · 0.80
handle_explainFunction · 0.80

Calls 2

readMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected