Index: openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl 27 Oct 2014 16:39:45 -0000 1.12 +++ openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl 7 Aug 2017 23:47:58 -0000 1.13 @@ -25,7 +25,7 @@ and a.object_type = t.object_type and a.attribute_id = :value) then 1 else 0 end - from dual + from dual }] } { return 1 } @@ -131,13 +131,13 @@ # the queries are empty because they are pulled out later in db_exec_plsql set plsql [list] - lappend plsql_drop [list "drop_attribute" "FOO" db_exec_plsql] - lappend plsql [list "create_attribute" "FOO" db_exec_plsql] + lappend plsql_drop [list db_exec_plsql "drop_attribute" "FOO"] + lappend plsql [list db_exec_plsql "create_attribute" "FOO"] set sql_type [datatype_to_sql_type -default $default_value $table_name $attribute_name $datatype] - lappend plsql_drop [list "drop_attr_column" "FOO" db_dml] - lappend plsql [list "add_column" "FOO" db_dml] + lappend plsql_drop [list db_dml "drop_attr_column" "FOO"] + lappend plsql [list db_dml "add_column" "FOO"] for { set i 0 } { $i < [llength $plsql] } { incr i } { set cmd [lindex $plsql $i] @@ -147,7 +147,7 @@ # execute drop statements until we reach position $i+1 # This position represents the operation on which we failed, and thus # is not executed - for { set inner [expr {[llength $plsql_drop] - 1}] } { $inner > $i + 1 } { set inner [expr {$inner - 1}] } { + for { set inner [expr {[llength $plsql_drop] - 1}] } { $inner > $i + 1 } { incr inner -1 } { set drop_cmd [lindex $plsql_drop $inner] if { [catch $drop_cmd err_msg_2] } { append err_msg "\nAdditional error while trying to roll back: $err_msg_2" @@ -235,14 +235,7 @@ # 2. Drop the attribute # 3. Return - if { ![db_0or1row select_attr_info { - select a.object_type, a.attribute_name, - decode(a.storage,'type_specific',t.table_name,a.table_name) as table_name, - nvl(a.column_name, a.attribute_name) as column_name - from acs_attributes a, acs_object_types t - where a.attribute_id = :attribute_id - and t.object_type = a.object_type - }] } { + if { ![db_0or1row select_attr_info {}] } { # Attribute doesn't exist return 0 } @@ -436,21 +429,7 @@ and a.storage in ('[join $include_storage_types "', '"]')" } - db_foreach select_attributes " - select nvl(a.column_name, a.attribute_name) as name, - a.pretty_name, a.attribute_id, a.datatype, - v.enum_value, v.pretty_name as value_pretty_name - from acs_object_type_attributes a, - acs_enum_values v, - (select t.object_type, level as type_level - from acs_object_types t - start with t.object_type = :start_with - connect by prior t.object_type = t.supertype) t - where a.object_type = :object_type - and a.attribute_id = v.attribute_id(+) - and t.object_type = a.ancestor_type $storage_clause - order by type_level, a.sort_order - " { + db_foreach select_attributes {} { # Enumeration values show up more than once... if {$name ni $attr_list} { lappend attr_list $name @@ -592,3 +571,9 @@ } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: