Support execute plugin for not connected server.

Добавлена возможность запускать плагины не поключаясь к БД.
Это нужно например чтобы запустить ssh клиента или сделать ssh тоннель.
Поддерживаются 3 переменные $$HOSTNAME,$$USERNAME,$$PORT.
Вот пример описания plugins.ini для запуска ssh клиента:
;
; Putty (Windows):
;
Title=Putty Console
Command="C:\Program Files\PuTTY\putty.exe" postgres@"$$HOSTNAME"
Description=Open a Putty console to the current database hostname.
KeyFile=C:\Program Files\PuTTY\putty.exe
Platform=windows
ServerType=postgresql
Database=No
SetPassword=No
;
This commit is contained in:
levinsv 2025-09-08 11:33:26 +05:00
parent d5a1c70f7b
commit f11fcfa4f6

View file

@ -295,7 +295,14 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj)
else
{
// Blank the rest
execCmd.Replace(wxT("$$HOSTNAME"), wxEmptyString);
if (obj && obj->GetMetaType() == PGM_SERVER) {
pgServer* srv = (pgServer*) obj;
execCmd.Replace(wxT("$$HOSTNAME"), srv->GetName());
execCmd.Replace(wxT("$$USERNAME"), srv->GetUsername());
execCmd.Replace(wxT("$$PORT"), NumToStr((long)srv->GetPort()));
} else
execCmd.Replace(wxT("$$HOSTNAME"), wxEmptyString);
execCmd.Replace(wxT("$$HOSTADDR"), wxEmptyString);
execCmd.Replace(wxT("$$PORT"), wxEmptyString);
execCmd.Replace(wxT("$$SSLMODE"), wxEmptyString);