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.26 -r1.97.2.27 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 7 Oct 2014 17:53:13 -0000 1.97.2.26 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 23 Mar 2015 11:34:41 -0000 1.97.2.27 @@ -705,13 +705,16 @@ -c_name $column_name } - require proc table {name definition} { + require proc table {name definition {populate ""}} { if {![my exists_table $name]} { set lines {} foreach col [dict keys $definition] {lappend lines "$col [dict get $definition $col]"} set definition [join $lines ",\n"] # my log "--table $name does not exist, creating with definition: $definition" ::xo::dc dml create-table-$name "create table $name ($definition)" + if {$populate ne ""} { + ::xo::dc dml populate-table-$name $populate + } } else { # The table exists already. Check the colums, whether we have to # add columns. We do not alter attribute types, and we do not @@ -1934,7 +1937,11 @@ foreach selection $sets { if {$named_objects} { set object_name ::[ns_set get $selection $object_named_after] - set o [$object_class create $object_name] + if {[info commands $object_name] eq ""} { + set o [$object_class create $object_name] + } else { + set o $object_name + } } else { set o [$object_class new] }