MCPcopy Create free account
hub / github.com/erans/pgsqlite / new

Method new

src/session/state.rs:56–82  ·  view source on GitHub ↗
(database: String, user: String)

Source from the content-addressed store, hash-verified

54
55impl SessionState {
56 pub fn new(database: String, user: String) -> Self {
57 let mut parameters = HashMap::new();
58 parameters.insert("server_version".to_string(), "16.0".to_string());
59 parameters.insert("server_encoding".to_string(), "UTF8".to_string());
60 parameters.insert("client_encoding".to_string(), "UTF8".to_string());
61 parameters.insert("DateStyle".to_string(), "ISO, MDY".to_string());
62 parameters.insert("TimeZone".to_string(), "UTC".to_string());
63 parameters.insert("IntervalStyle".to_string(), "postgres".to_string());
64 parameters.insert("integer_datetimes".to_string(), "on".to_string());
65
66 // Increment active session count
67 ACTIVE_SESSION_COUNT.fetch_add(1, Ordering::Relaxed);
68
69 SessionState {
70 id: uuid::Uuid::new_v4(),
71 database,
72 user,
73 parameters: RwLock::new(parameters),
74 prepared_statements: RwLock::new(HashMap::new()),
75 portals: RwLock::new(HashMap::new()),
76 transaction_status: RwLock::new(TransactionStatus::Idle),
77 portal_manager: Arc::new(super::PortalManager::new(100)), // Allow up to 100 concurrent portals
78 python_param_mapping: RwLock::new(HashMap::new()),
79 db_handler: Mutex::new(None), // Will be set after session is created
80 cached_connection: ParkingMutex::new(None), // Initialize as None
81 }
82 }
83
84 /// Create a new session with default database and user (for testing)
85 #[cfg(test)]

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected