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 -N -r1.4 -r1.4.4.1
--- openacs-4/packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl 22 Apr 2003 01:12:26 -0000 1.4
+++ openacs-4/packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl 30 Jun 2004 04:09:42 -0000 1.4.4.1
@@ -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]
@@ -397,7 +431,7 @@
# current_contraint_info -- a constraint_info_set for the constraint being processed in the loop below
set check_constraint_set [ns_set create]
- if {[string match {7.[3]*} [db_version]]} {
+ if {![string match {7.[12]*} [db_version]]} {
db_foreach schema_browser_index_get_subselect "
select
conname as constraint_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 -N -r1.1 -r1.1.10.1
--- 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 30 Jun 2004 04:09:42 -0000 1.1.10.1
@@ -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.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/function-body.tcl,v
diff -u -N -r1.3 -r1.3.8.1
--- 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 30 Jun 2004 04:09:42 -0000 1.3.8.1
@@ -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.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/www/index.tcl,v
diff -u -N -r1.4 -r1.4.4.1
--- 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 30 Jun 2004 04:09:42 -0000 1.4.4.1
@@ -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]
-
-
-
-