Skip site navigation (1) Skip section navigation (2)

SVN Commit by dpage: r4419 - trunk/pgadmin3/src/schema

From: svn(at)pgadmin(dot)org
To: pgadmin-hackers(at)postgresql(dot)org
Subject: SVN Commit by dpage: r4419 - trunk/pgadmin3/src/schema
Date: 2005-08-28 20:10:08
Message-ID: 200508282010.j7SKA8dn007687@developer.pgadmin.org (view raw or flat)
Thread:
Lists: pgadmin-hackers
Author: dpage
Date: 2005-08-28 21:10:08 +0100 (Sun, 28 Aug 2005)
New Revision: 4419

Modified:
   trunk/pgadmin3/src/schema/pgDatabase.cpp
   trunk/pgadmin3/src/schema/pgIndex.cpp
   trunk/pgadmin3/src/schema/pgTable.cpp
   trunk/pgadmin3/src/schema/pgTablespace.cpp
Log:
Update for file size functions in 8.1

Modified: trunk/pgadmin3/src/schema/pgDatabase.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgDatabase.cpp	2005-08-28 19:29:44 UTC (rev 4418)
+++ trunk/pgadmin3/src/schema/pgDatabase.cpp	2005-08-28 20:10:08 UTC (rev 4419)
@@ -480,7 +480,8 @@
 {
     wxLogInfo(wxT("Displaying statistics for databases on ") + GetServer()->GetIdentifier());
 
-    bool hasSize=GetConnection()->HasFeature(FEATURE_SIZE);
+    // 8.1 has the database size functions built in.
+    bool hasSize=(GetConnection()->HasFeature(FEATURE_SIZE) || GetConnection()->BackendMinimumVersion(8, 1));
 
     wxString sql=wxT("SELECT datname, numbackends, xact_commit, xact_rollback, blks_read, blks_hit");
 

Modified: trunk/pgadmin3/src/schema/pgIndex.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgIndex.cpp	2005-08-28 19:29:44 UTC (rev 4418)
+++ trunk/pgadmin3/src/schema/pgIndex.cpp	2005-08-28 20:10:08 UTC (rev 4419)
@@ -215,7 +215,8 @@
 
 void pgIndexBase::ShowStatistics(frmMain *form, ctlListView *statistics)
 {
-    if (GetConnection()->HasFeature(FEATURE_SIZE))
+    // 8.1 has the database size functions built in.
+    if (GetConnection()->HasFeature(FEATURE_SIZE) || GetConnection()->BackendMinimumVersion(8, 1))
         DisplayStatistics(statistics, 
             wxT("SELECT pg_size_pretty(pg_relation_size(") + GetOidStr() + wxT(")) AS ") + qtIdent(_("Index Size")));
 }

Modified: trunk/pgadmin3/src/schema/pgTable.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgTable.cpp	2005-08-28 19:29:44 UTC (rev 4418)
+++ trunk/pgadmin3/src/schema/pgTable.cpp	2005-08-28 20:10:08 UTC (rev 4419)
@@ -480,7 +480,8 @@
 {
     wxLogInfo(wxT("Displaying statistics for tables on ")+ GetSchema()->GetIdentifier());
 
-    bool hasSize=GetConnection()->HasFeature(FEATURE_SIZE);
+    // 8.1 has the database size functions built in.
+    bool hasSize=(GetConnection()->HasFeature(FEATURE_SIZE) || GetConnection()->BackendMinimumVersion(8, 1));
 
     // Add the statistics view columns
     statistics->ClearAll();
@@ -545,8 +546,8 @@
              wxT(", toast_blks_hit AS ") + qtIdent(_("Toast Blocks Hit")) +
              wxT(", tidx_blks_read AS ") + qtIdent(_("Toast Index Blocks Read")) +
              wxT(", tidx_blks_hit AS ") + qtIdent(_("Toast Index Blocks Hit"));
-    
-    if (GetConnection()->HasFeature(FEATURE_SIZE))
+
+    if (GetConnection()->HasFeature(FEATURE_SIZE) || GetConnection()->BackendMinimumVersion(8, 1))
     {
         sql += wxT(", pg_size_pretty(pg_relation_size(stat.relid)) AS ") + qtIdent(_("Table Size"))
             +  wxT(", CASE WHEN cl.reltoastrelid = 0 THEN ") + qtString(_("none")) + wxT(" ELSE pg_size_pretty(pg_relation_size(cl.reltoastrelid)+ COALESCE((SELECT SUM(pg_relation_size(indexrelid)) FROM pg_index WHERE indrelid=cl.reltoastrelid)::int8, 0)) END AS ") + qtIdent(_("Toast Table Size"))

Modified: trunk/pgadmin3/src/schema/pgTablespace.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgTablespace.cpp	2005-08-28 19:29:44 UTC (rev 4418)
+++ trunk/pgadmin3/src/schema/pgTablespace.cpp	2005-08-28 20:10:08 UTC (rev 4419)
@@ -133,7 +133,7 @@
 {
     if (statistics)
     {
-        if (GetConnection()->HasFeature(FEATURE_SIZE))
+        if (GetConnection()->HasFeature(FEATURE_SIZE) || GetConnection()->BackendMinimumVersion(8, 1))
         {
             wxLogInfo(wxT("Displaying statistics for %s"), GetTypeName().c_str());
 
@@ -220,7 +220,7 @@
 
 void pgTablespaceCollection::ShowStatistics(frmMain *form, ctlListView *statistics)
 {
-    if (GetConnection()->HasFeature(FEATURE_SIZE))
+    if (GetConnection()->HasFeature(FEATURE_SIZE) || GetConnection()->BackendMinimumVersion(8, 1))
     {
         wxLogInfo(wxT("Displaying statistics for tablespaces"));
 


pgadmin-hackers by date

Next:From: svnDate: 2005-08-28 20:18:31
Subject: SVN Commit by dpage: r4420 - trunk/pgadmin3/src/schema
Previous:From: Andreas PflugDate: 2005-08-27 20:32:24
Subject: Re: Developers documentation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group