Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

feat(windows): expose PostgreSQLAdapter config + password getters

DangHuynhcba6cc9355a0
diff --git a/windows/Gridex/Models/PostgreSQLAdapter.h b/windows/Gridex/Models/PostgreSQLAdapter.h
index e0ab5a7..cb6d9d4 100644
--- a/windows/Gridex/Models/PostgreSQLAdapter.h
+++ b/windows/Gridex/Models/PostgreSQLAdapter.h
@@ -68,9 +68,18 @@ namespace DBModels
std::wstring quoteSqlLiteral(const std::wstring& value) const override;
std::wstring quoteSqlIdentifier(const std::wstring& name) const override;
+ // Getters so hosts can open a second "side" connection with the
+ // same credentials (used by the EE connection monitor to avoid
+ // serializing its pg_stat_activity polling against the user's
+ // foreground SQL editor queries on the primary PGconn).
+ const ConnectionConfig& getConnectionConfig() const { return storedConfig_; }
+ const std::wstring& getStoredPassword() const { return storedPassword_; }
+
private:
PGconn* conn_ = nullptr;
bool connected_ = false;
+ ConnectionConfig storedConfig_;
+ std::wstring storedPassword_;
// Helper: convert wstring to UTF-8 for libpq
static std::string toUtf8(const std::wstring& wstr);
diff --git a/windows/Gridex/PostgreSQLAdapter.cpp b/windows/Gridex/PostgreSQLAdapter.cpp
index eea2fb4..b7e6ff2 100644
--- a/windows/Gridex/PostgreSQLAdapter.cpp
+++ b/windows/Gridex/PostgreSQLAdapter.cpp
@@ -87,6 +87,12 @@ namespace DBModels
{
disconnect();
+ // Stash creds so callers can spawn side-connections (e.g. the EE
+ // connection monitor needs its own PGconn so polling doesn't
+ // serialize against the user's foreground queries).
+ storedConfig_ = config;
+ storedPassword_ = password;
+
// Build connection string
std::string connStr;
connStr += "host=" + toUtf8(config.host);