xo::db::require proc table

 xo::db::require[i] table

Defined in

Partial Call Graph (max 5 caller/called nodes):
%3 test_xotcl-core xotcl-core (test ) xo::db::require proc table xo::db::require proc table test_xotcl-core->xo::db::require proc table test_xotcl_core_tutorial_2 xotcl_core_tutorial_2 (test ) test_xotcl_core_tutorial_2->xo::db::require proc table

Testcases:
xotcl_core_tutorial_2, xotcl-core
Source code:
#:log "==== require table $name exists: [:exists_table $name]\n$definition"
if {![:exists_table $name]} {
  set lines {}
  foreach col [dict keys $definition] {lappend lines "$col [dict get $definition $col]"}
  set definition [join $lines ",\n"]
  # :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 columns, whether we have to
  # add columns. We do not alter attribute types, and we do not
  # delete columns.
  foreach col [dict keys $definition] {
    if {![:exists_column $name $col]} {
      ns_log notice "xodb: adding column <alter table $name add column $col [dict get $definition $col]>"
      ::xo::dc dml alter-table-$name  "alter table $name add column $col [dict get $definition $col]"
    }
  }
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: