Log Message: ----------- pg_postmaster_starttime for win32 Modified Files: -------------- pgadmin3: CHANGELOG.txt (r1.125 -> r1.126) pgadmin3/src/schema: pgServer.cpp (r1.49 -> r1.50) pgadmin3/src/include: pgServer.h (r1.39 -> r1.40) pgfeatures.h (r1.2 -> r1.3) pgadmin3/src/ui: frmStatus.cpp (r1.39 -> r1.40) pgadmin3/src/db: pgConn.cpp (r1.53 -> r1.54)
Index: CHANGELOG.txt =================================================================== RCS file: /projects/pgadmin3/CHANGELOG.txt,v retrieving revision 1.125 retrieving revision 1.126 diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.125 -r1.126 --- CHANGELOG.txt +++ CHANGELOG.txt @@ -16,6 +16,8 @@ </ul> <br> <ul> + <li>2004-08-18 AP set PGPASSWORD environment for backup/restore + <li>2004-08-18 AP fix ACL for quoted user/group names <li>2004-08-15 AP buglet cleanups <li>2004-08-11 AP restore wizard <li>2004-08-11 AP rework of ctlComboBox Index: pgServer.cpp =================================================================== RCS file: /projects/pgadmin3/src/schema/pgServer.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -Lsrc/schema/pgServer.cpp -Lsrc/schema/pgServer.cpp -u -w -r1.49 -r1.50 --- src/schema/pgServer.cpp +++ src/schema/pgServer.cpp @@ -20,6 +20,7 @@ #include "pgServer.h" #include "pgObject.h" #include "pgCollection.h" +#include "pgfeatures.h" pgServer::pgServer(const wxString& newName, const wxString& newDescription, const wxString& newDatabase, const wxString& newUsername, int newPort, bool _trusted, int _ssl) @@ -292,11 +293,18 @@ if (conn->BackendMinimumVersion(7, 3)) { connected = true; - pgSet *set=ExecuteSet(wxT("SELECT usecreatedb, usesuper from pg_user where usename=current_user")); + + wxString sql = wxT("SELECT usecreatedb, usesuper"); + if (conn->HasFeature(FEATURE_POSTMASTER_STARTTIME)) + sql += wxT(", CASE WHEN usesuper THEN pg_postmaster_starttime() ELSE NULL END as upsince"); + + pgSet *set=ExecuteSet(sql + wxT("\n FROM pg_user WHERE usename=current_user")); if (set) { iSetCreatePrivilege(set->GetBool(wxT("usecreatedb"))); iSetSuperUser(set->GetBool(wxT("usesuper"))); + if (conn->HasFeature(FEATURE_POSTMASTER_STARTTIME)) + iSetUpSince(set->GetDateTime(wxT("upsince"))); delete set; } } @@ -485,6 +493,8 @@ properties->AppendItem(_("Last system OID"), GetLastSystemOID()); } properties->AppendItem(_("Connected?"), GetConnected()); + if (GetUpSince().IsValid()) + properties->AppendItem(_("Up since"), GetUpSince()); if (GetServerControllable()) properties->AppendItem(_("Running?"), GetServerRunning()); } Index: pgfeatures.h =================================================================== RCS file: /projects/pgadmin3/src/include/pgfeatures.h,v retrieving revision 1.2 retrieving revision 1.3 diff -Lsrc/include/pgfeatures.h -Lsrc/include/pgfeatures.h -u -w -r1.2 -r1.3 --- src/include/pgfeatures.h +++ src/include/pgfeatures.h @@ -15,5 +15,7 @@ FEATURE_SIZE, FEATURE_FILEREAD, FEATURE_ROTATELOG, + FEATURE_POSTMASTER_STARTTIME, + FEATURE_TERMINATE_BACKEND, FEATURE_LAST }; Index: pgServer.h =================================================================== RCS file: /projects/pgadmin3/src/include/pgServer.h,v retrieving revision 1.39 retrieving revision 1.40 diff -Lsrc/include/pgServer.h -Lsrc/include/pgServer.h -u -w -r1.39 -r1.40 --- src/include/pgServer.h +++ src/include/pgServer.h @@ -83,6 +83,8 @@ void iSetTrusted(const bool b) { trusted=b; } void iSetNeedPwd(const bool b) { trusted=!b; } bool SetPassword(const wxString& newVal); + wxDateTime GetUpSince() { return upSince; } + void iSetUpSince(const wxDateTime &d) { upSince = d; } bool HasPrivilege(const wxString &objTyp, const wxString &objName, const wxString &priv) { return conn->HasPrivilege(objTyp, objName, priv); } bool ExecuteVoid(const wxString& sql) { return conn->ExecuteVoid(sql); } @@ -105,6 +107,7 @@ bool connected; wxString database, username, password, ver, error; wxString lastDatabase, lastSchema, description, serviceId; + wxDateTime upSince; int port, ssl; bool trusted, discovered, createPrivilege, superUser; OID lastSystemOID; Index: frmStatus.cpp =================================================================== RCS file: /projects/pgadmin3/src/ui/frmStatus.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -Lsrc/ui/frmStatus.cpp -Lsrc/ui/frmStatus.cpp -u -w -r1.39 -r1.40 --- src/ui/frmStatus.cpp +++ src/ui/frmStatus.cpp @@ -821,6 +821,7 @@ if(statusList->GetSelectedItemCount() >= 0) { btnCancelSt->Enable(true); + if (connection->HasFeature(FEATURE_TERMINATE_BACKEND)) btnTerminateSt->Enable(true); } else @@ -838,6 +839,7 @@ if(lockList->GetSelectedItemCount() >= 0) { btnCancelLk->Enable(true); + if (connection->HasFeature(FEATURE_TERMINATE_BACKEND)) btnTerminateLk->Enable(true); } else Index: pgConn.cpp =================================================================== RCS file: /projects/pgadmin3/src/db/pgConn.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -Lsrc/db/pgConn.cpp -Lsrc/db/pgConn.cpp -u -w -r1.53 -r1.54 --- src/db/pgConn.cpp +++ src/db/pgConn.cpp @@ -456,6 +456,18 @@ wxT(" WHERE proname = 'pg_rotate_log'") wxT( " AND pronargs = 0")) .IsEmpty(); + features[FEATURE_POSTMASTER_STARTTIME] = + !ExecuteScalar( + wxT("SELECT proname FROM pg_proc\n") + wxT(" WHERE proname = 'pg_postmaster_starttime'") + wxT( " AND pronargs = 0")) + .IsEmpty(); + features[FEATURE_TERMINATE_BACKEND] = + !ExecuteScalar( + wxT("SELECT proname FROM pg_proc\n") + wxT(" WHERE proname = 'pg_terminate_backend'") + wxT( " AND pronargs = 1")) + .IsEmpty(); } if (featureNo < 1 ||featureNo >= FEATURE_LAST)
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html