Index: openacs-4/packages/schema-browser/tcl/schema-browser-procs-oracle.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/schema-browser/tcl/schema-browser-procs-oracle.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/schema-browser/tcl/schema-browser-procs-oracle.tcl 7 Apr 2018 11:30:04 -0000 1.7 +++ openacs-4/packages/schema-browser/tcl/schema-browser-procs-oracle.tcl 16 May 2018 20:37:07 -0000 1.8 @@ -6,7 +6,7 @@ set tables "" - db_foreach schema_browser_index_get_tables "select table_name + db_foreach schema_browser_index_get_tables "select table_name from user_tables order by table_name" { lappend tables $table_name } @@ -23,31 +23,29 @@ set tables [util_memoize "sb_get_tables_list"] - set n_rows [expr ([llength $tables] - 1) / $n_columns + 1] + set n_rows [expr {([llength $tables] - 1) / $n_columns + 1}] append return_string "
[string tolower $table_name] | " - } else { - set href [export_vars -base index {table_name}] - append return_string [subst {[string tolower $table_name] | }] - } - } - - } - append return_string "
[string tolower $table_name] | " + } else { + set href [export_vars -base index {table_name}] + append return_string [subst {[string tolower $table_name] | }] + } + } + } + append return_string "
" append html "\nCREATE TABLE [string tolower $table_name] (" - + set column_list [list] set column_info_set [ns_set create] db_foreach schema_browser_index_get_user_table_data " @@ -257,9 +255,9 @@ # find the column and table constraints # # table_constraint_list -- a list of constraint_info_sets for all constraints involving more than one column - set table_constraint_list [list] - + set table_constraint_list [list] + # current_constraint_info -- a constraint_info_set for the constraint being processed in the loop below set constraint_info [ns_set new] @@ -272,21 +270,21 @@ decode(columns.constraint_type,'P',0,'U',1,'R',2,'C',3,4) as constraint_type_ordering, parent_columns.table_name as foreign_table_name, parent_columns.column_name as foreign_column_name - from ( - select + from ( + select col.table_name, - con.constraint_name, - column_name, - constraint_type, - search_condition, + con.constraint_name, + column_name, + constraint_type, + search_condition, r_constraint_name, - position + position from user_constraints con, user_cons_columns col where con.constraint_name = col.constraint_name - ) columns, + ) columns, user_cons_columns parent_columns where columns.table_name = upper(:table_name) and constraint_type in ('P','U','C','R') and @@ -297,7 +295,7 @@ constraint_name, columns.position " { - + if { $constraint_name != [ns_set get $constraint_info "constraint_name"] } { if { [ns_set get $constraint_info "constraint_name"] != "" } { # we've reached a new constraint, so finish processing the old one @@ -323,13 +321,13 @@ lappend constraint_columns $column_name ns_set update $constraint_info "constraint_columns" $constraint_columns if { $foreign_column_name != "" } { - set foreign_columns [ns_set get $constraint_info "foreign_columns"] + set foreign_columns [ns_set get $constraint_info "foreign_columns"] lappend foreign_columns $foreign_column_name ns_set put $constraint_info "constraint_columns" $foreign_columns } } } - + # we've run out of rows, but need to flush out the open current_constraint if { [ns_set get $constraint_info "constraint_name"] != "" } { if { [llength [ns_set get $constraint_info "constraint_columns"]] > 1 } { @@ -342,7 +340,7 @@ # # write out the columns with associated constraints # - + set n_column 0 set hanging_comment "" @@ -386,10 +384,10 @@ } elseif { $constraint_type == "C" } { # check constraint ignore not-null checks # because we already handled them - if { [string first "NOT NULL" [ns_set get $constraint "search_condition"]] == -1 } { + if { [string first "NOT NULL" [ns_set get $constraint "search_condition"]] == -1 } { append html "\n\t\tCHECK [ns_set get $constraint "constraint_name"]([ns_set get $constraint "search_condition"])" } - } + } } incr n_column } @@ -401,7 +399,7 @@ # # write out the table-level constraints in the table_constraint_list # - + foreach constraint $table_constraint_list { set constraint_type [ns_set get $constraint "constraint_type"] set constraint_name [ns_set get $constraint "constraint_name"] @@ -421,14 +419,14 @@ append html "[string tolower [join $foreign_columns ","]])" } } - + append html "\n);" append html [sb_get_indexes $table_name] append html [sb_get_triggers $table_name] append html [sb_get_child_tables $table_name "t"] append html "" - + return $html - + }