Index: openacs-4/packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl 20 May 2004 13:55:13 -0000 1.5
+++ openacs-4/packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl 28 Jun 2004 05:30:02 -0000 1.6
@@ -302,6 +302,40 @@
return [list [array get references] $complex_foreign_keys]
}
+
+ad_proc -public sb_get_table_size {
+ {-table_name:required}
+ {-namespace {public}}
+ {-block_size {8192}}
+} {
+ Returns the size of the table on disk. This information is only updated
+ by the commands VACUUM, ANALYZE, and CREATE INDEX. Thus, if you have
+ been changing your table, run ANALYZE on the table before running this
+ proc.
+
+ @param table_name The table name
+ @param namespace The database namespace that contains the table
+ @param block_size Size of BLCKSZ (in bytes) used by the database
+
+ @return This procedure returns a list with 2 items:
+
+ - Size of the table on disk (in bytes)
+
- Number of rows in the table
+
+
+ @author Gabriel Burca (gburca-openacs@ebixio.com)
+ @creation-date 2004-06-27
+} {
+ db_1row sb_get_table_size "
+ select relpages * :block_size as size_in_bytes, reltuples as table_rows
+ from pg_class
+ where relnamespace = (select oid from pg_namespace where nspname = :namespace)
+ and relname = :table_name
+ "
+ return [list $size_in_bytes $table_rows]
+}
+
+
ad_proc sb_get_table_description { table_name } {} {
set foreign_keys [sb_get_foreign_keys $table_name]
@@ -505,6 +539,11 @@
append html [sb_get_indexes $table_name]
append html [sb_get_triggers $table_name]
append html [sb_get_child_tables $table_name "t"]
+
+ set table_size [sb_get_table_size -table_name $table_name]
+ append html "\n\n-- Table size: [util_commify_number [lindex $table_size 0]] bytes\n"
+ append html "-- Table rows: [util_commify_number [lindex $table_size 1]]\n"
+
append html ""
return $html
Index: openacs-4/packages/schema-browser/www/function-body-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/function-body-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/schema-browser/www/function-body-postgresql.xql 15 Sep 2001 00:32:45 -0000 1.1
+++ openacs-4/packages/schema-browser/www/function-body-postgresql.xql 28 Jun 2004 05:30:03 -0000 1.2
@@ -6,7 +6,7 @@
select
- prosrc
+ proname as function_name, prosrc as function_src
from
pg_proc
where
Index: openacs-4/packages/schema-browser/www/function-body.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/function-body.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/schema-browser/www/function-body.adp 28 Jun 2004 05:30:03 -0000 1.1
@@ -0,0 +1,9 @@
+
+@context@
+@page_title@
+
+
+
+@function_src@
+
+
Index: openacs-4/packages/schema-browser/www/function-body.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/function-body.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/schema-browser/www/function-body.tcl 18 Sep 2002 14:54:59 -0000 1.3
+++ openacs-4/packages/schema-browser/www/function-body.tcl 28 Jun 2004 05:30:03 -0000 1.4
@@ -13,19 +13,8 @@
}
-set html "[ad_header "[ad_system_name] One Trigger's Function Body "]
-
-[ad_system_name] Schema Browser
-[ad_context_bar_ws [list "./" "Schema Browser"] "One Trigger's Function Body"]
-"
-
-
db_1row function_body ""
-append html "
-
-$prosrc
-[ad_footer]
-"
+set context [list "Trigger: $function_name"]
+set page_title "Trigger: $function_name"
-doc_return 200 text/html $html
Index: openacs-4/packages/schema-browser/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/schema-browser/www/index.adp 28 Jun 2004 05:30:03 -0000 1.1
@@ -0,0 +1,11 @@
+
+@context;noquote@
+@page_title@
+
+
+@table_description;noquote@
+
+
+
Tables:
+@table_list;noquote@
+
Index: openacs-4/packages/schema-browser/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/index.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/schema-browser/www/index.tcl 24 Oct 2003 10:21:07 -0000 1.4
+++ openacs-4/packages/schema-browser/www/index.tcl 28 Jun 2004 05:30:03 -0000 1.5
@@ -34,31 +34,15 @@
if { [exists_and_not_null table_name] } {
- set context_bar [ad_context_bar $table_name]
+ set context [list "Table: $table_name"]
+ set page_title "Table: $table_name"
+ set table_description [sb_get_table_description $table_name]
} else {
- set context_bar [ad_context_bar]
-}
-
-set page_content "[ad_header "[ad_system_name] Schema Browser"]
-
-[ad_system_name] Schema Browser
-$context_bar
-
-"
-
-if { [exists_and_not_null table_name] } {
- append page_content [sb_get_table_description $table_name]
-} else {
+ set context ""
+ set page_title "Schema Browser"
set table_name ""
}
-append page_content "Tables:
-[sb_get_tables $table_name]
-[ad_footer]"
-doc_return 200 text/html $page_content
+set table_list [sb_get_tables $table_name]
-
-
-
-