Index: openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl,v diff -u -r1.97.2.23 -r1.97.2.24 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 22 Sep 2014 11:09:26 -0000 1.97.2.23 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 22 Sep 2014 12:30:24 -0000 1.97.2.24 @@ -644,7 +644,9 @@ # Installations with acs-kernel prior to 5.8.1a6 (or later, before running upgrade script) # won't have these procs. We define them here if missing to avoid breaking running instances during transition. - if {![::xotcl::Class isobject "::xo::db::sql::util"]} {::xo::db::Class create "::xo::db::sql::util"} + if {![::xotcl::Class isobject "::xo::db::sql::util"]} { + ::xotcl::Class create ::xo::db::sql::util + } if {[::xo::db::sql::util info commands table_exists] eq ""} { ::xo::db::sql::util ad_proc table_exists {-name:required} {Transitional method} { set query [expr {[db_driverkey ""] eq "oracle" ? @@ -672,8 +674,8 @@ if {[::xo::db::sql::util info commands table_column_exists] eq ""} { ::xo::db::sql::util ad_proc table_column_exists {-t_name:required -c_name:required} {Transitional method} { set query [expr {[db_driverkey ""] eq "oracle" ? - {select 1 from user_tab_columns where table_name = :table_name and column_name = :column_name} : - {select 1 from information_schema.columns where table_name = :table_name and column_name = :column_name}}] + {select 1 from user_tab_columns where table_name = :t_name and column_name = :c_name} : + {select 1 from information_schema.columns where table_name = :t_name and column_name = :c_name}}] ::xo::dc 0or1row query $query } } @@ -704,6 +706,15 @@ } require proc table {name definition} { + # Since rev. 1.97.2.18, definition must be in dict format. + # To comply with previous table definitions given as plain string, + # we check for definition being a one-element list, and if so + # we translate definition to dict format. + set dict_def {}; if {[llength $definition] == 1} { + foreach col [split $definition ,] { + lappend dict_def [lindex $col 0] [lrange $col 1 end] + } + } ; set definition $dict_def if {![my exists_table $name]} { set lines {} foreach col [dict keys $definition] {lappend lines "$col [dict get $definition $col]"}