• Publicity: Public Only All

schema-browser-procs-postgresql.tcl

Took these defs out of the /www/doc/schema-browser/index.tcl file.

Location:
packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl

Procedures in this file

Detailed information

sb_get_child_tables (public)

 sb_get_child_tables table_name [ html_anchor_p ]

Build an HTML snippet listing all tables which have at least one foreign key referring to table_name.

Parameters:
table_name
html_anchor_p (defaults to "f")

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_child_tables sb_get_child_tables sb_get_table_description->sb_get_child_tables db_foreach db_foreach (public) sb_get_child_tables->db_foreach

Testcases:
No testcase defined.

sb_get_foreign_keys (public)

 sb_get_foreign_keys table_name

Build a list describing all foreign keys on table_name and their actions. We ignore MATCH conditions because Oracle doesn't support them, therefore, OpenACS doesn't use them. Same is true of SET NULL and SET DEFAULT actions hung on ON DELETE/ON UPDATE subclauses, but since Oracle *does* support CASCADE as an action I had figure out how to grab this info from the system catalog anyway. This code is *horribly* convoluted, mostly a result of the non-obvious way that the needed information is organized in the PG system catalogs. g Feel free to clean this up if you want!

Parameters:
table_name
Author:
Don Baccus, though he hates to admit to writing such ugly code <dhogaza@pacifier.com>

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_foreign_keys sb_get_foreign_keys sb_get_table_description->sb_get_foreign_keys db_foreach db_foreach (public) sb_get_foreign_keys->db_foreach

Testcases:
No testcase defined.

sb_get_indexes (public)

 sb_get_indexes table_name [ html_anchors_p ] [ pki ]

Create statements for indexes on table_name.

Parameters:
table_name
html_anchors_p (defaults to "f")
pki (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_indexes sb_get_indexes sb_get_table_description->sb_get_indexes db_foreach db_foreach (public) sb_get_indexes->db_foreach db_list_of_lists db_list_of_lists (public) sb_get_indexes->db_list_of_lists

Testcases:
No testcase defined.

sb_get_table_description (public)

 sb_get_table_description table_name
Parameters:
table_name

Partial Call Graph (max 5 caller/called nodes):
%3 packages/schema-browser/www/index.tcl packages/schema-browser/ www/index.tcl sb_get_table_description sb_get_table_description packages/schema-browser/www/index.tcl->sb_get_table_description ad_text_to_html ad_text_to_html (public) sb_get_table_description->ad_text_to_html db_0or1row db_0or1row (public) sb_get_table_description->db_0or1row db_foreach db_foreach (public) sb_get_table_description->db_foreach db_list db_list (public) sb_get_table_description->db_list lc_numeric lc_numeric (public) sb_get_table_description->lc_numeric

Testcases:
No testcase defined.

sb_get_table_size (public)

 sb_get_table_size -table_name table_name [ -namespace namespace ] \
    [ -block_size block_size ]

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.

Switches:
-table_name
(required)
The table name
-namespace
(defaults to "public") (optional)
The database namespace that contains the table
-block_size
(defaults to "8192") (optional)
Size of BLCKSZ (in bytes) used by the database
Returns:
This procedure returns a list with 2 items:
  1. Size of the table on disk (in bytes), or -1 if the table was not found
  2. Number of rows in the table, or -1 if the table was not found
Author:
Gabriel Burca <gburca-openacs@ebixio.com>
Created:
2004-06-27

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_table_size sb_get_table_size sb_get_table_description->sb_get_table_size db_0or1row db_0or1row (public) sb_get_table_size->db_0or1row

Testcases:
No testcase defined.

sb_get_tables (public)

 sb_get_tables selected_table_name

Build an HTML table of all PG tables belonging to the current user. Each PG table name is returned as a hyperlink to a page which displays the table's structure.

Parameters:
selected_table_name

Partial Call Graph (max 5 caller/called nodes):
%3 packages/schema-browser/www/index.tcl packages/schema-browser/ www/index.tcl sb_get_tables sb_get_tables packages/schema-browser/www/index.tcl->sb_get_tables export_vars export_vars (public) sb_get_tables->export_vars sb_get_tables_list sb_get_tables_list (public) sb_get_tables->sb_get_tables_list

Testcases:
No testcase defined.

sb_get_tables_list (public)

 sb_get_tables_list

Get all tables that belong to the current user.

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_tables sb_get_tables (public) sb_get_tables_list sb_get_tables_list sb_get_tables->sb_get_tables_list db_list db_list (public) sb_get_tables_list->db_list

Testcases:
No testcase defined.

sb_get_triggers (public)

 sb_get_triggers table_name

Get all non-RI triggers on the table.

Parameters:
table_name

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_triggers sb_get_triggers sb_get_table_description->sb_get_triggers db_foreach db_foreach (public) sb_get_triggers->db_foreach

Testcases:
No testcase defined.
[ show source ]