| |
18 |
18 |
|
| |
19 |
19 |
ad_proc sb_get_tables { selected_table_name } {} { |
| |
20 |
20 |
|
| |
21 |
21 |
set n_columns 4 |
| |
22 |
22 |
set return_string "" |
| |
23 |
23 |
|
| |
24 |
24 |
set tables [util_memoize "sb_get_tables_list"] |
| |
25 |
25 |
|
| |
26 |
26 |
set n_rows [expr ([llength $tables] - 1) / $n_columns + 1] |
| |
27 |
27 |
|
| |
28 |
28 |
append return_string "<table>" |
| |
29 |
29 |
for { set row 0 } { $row < $n_rows } { incr row } { |
| |
30 |
30 |
append return_string "<tr>" |
| |
31 |
31 |
for {set column 0} {$column < $n_columns} {incr column} { |
| |
32 |
32 |
set i_element [expr $n_rows * $column + $row] |
| |
33 |
33 |
if { $i_element < [llength $tables] } { |
| |
34 |
34 |
set table_name [lindex $tables $i_element] |
| |
35 |
35 |
if { $table_name == $selected_table_name } { |
| |
36 |
36 |
append return_string "<td><b>[string tolower $table_name]</b></td>" |
| |
37 |
37 |
} else { |
| |
38 |
|
append return_string "<td><a href=\"index?[export_vars -url {table_name}]\">[string tolower $table_name]</a></td>" |
| |
|
38 |
set href [export_vars -base index {table_name}] |
| |
|
39 |
append return_string [subst {<td><a href="[ns_quotehtml $href]">[string tolower $table_name]</a></td>}] |
| |
39 |
40 |
} |
| |
40 |
41 |
} |
| |
41 |
42 |
|
| |
42 |
43 |
} |
| |
43 |
44 |
append return_string "</tr>" |
| |
44 |
45 |
} |
| |
45 |
46 |
|
| |
46 |
47 |
append return_string "</table>" |
| |
47 |
48 |
|
| |
48 |
49 |
return $return_string |
| |
49 |
50 |
|
| |
50 |
51 |
} |
| |
51 |
52 |
|
| |
52 |
53 |
ad_proc sb_get_triggers { table_name } {} { |
| |
53 |
54 |
set return_string "\n-- $table_name triggers:" |
| |
54 |
55 |
db_foreach sb_get_triggers_select_1 " |
| |
55 |
56 |
select |
| |
56 |
57 |
trigger_name, |
| |
57 |
58 |
trigger_type, |
| |
58 |
59 |
triggering_event, |
| |
59 |
60 |
status |
| |
60 |
61 |
from |
| |
61 |
62 |
user_triggers |
| |
62 |
63 |
where |
| |
63 |
64 |
table_name = upper(:table_name) |
| |
64 |
65 |
" { |
| |
65 |
|
append return_string "\n--\t<a href=\"trigger?[export_vars -url {trigger_name}]\">$trigger_name</a> $triggering_event $trigger_type $status" |
| |
|
66 |
set href [export_vars -base trigger {trigger_name}] |
| |
|
67 |
append return_string [subst { |
| |
|
68 |
--\t<a href="[ns_quotehtml $href]">$trigger_name</a> $triggering_event $trigger_type $status}] |
| |
66 |
69 |
} if_no_rows { |
| |
67 |
70 |
append return_string "\n--\tnone" |
| |
68 |
71 |
} |
| |
69 |
72 |
|
| |
70 |
73 |
return $return_string |
| |
71 |
74 |
} |
| |
72 |
75 |
|
| |
73 |
76 |
ad_proc sb_get_child_tables { table_name {html_anchor_p "f"} } {} { |
| |
74 |
77 |
|
| |
75 |
78 |
# |
| |
76 |
79 |
# child tables -- put in comments about each child table that references this one |
| |
77 |
80 |
# |
| |
78 |
81 |
|
| |
79 |
82 |
set return_string "" |
| |
80 |
83 |
|
| |
81 |
84 |
# this takes about 8 minutes to run -- for one table! |
| |
82 |
85 |
# set selection [ns_db select $db " |
| |
83 |
86 |
# select |
| |
84 |
87 |
# childcon.constraint_name, |
| |
85 |
88 |
# parentcol.column_name as parent_column, |