xo::db::sql::content_type proc create_type (public)

 xo::db::sql::content_type[i] create_type [ -dbn dbn ] \
    -content_type content_type  [ -supertype supertype ] \
    -pretty_name pretty_name  -pretty_plural pretty_plural  \
    -table_name table_name  [ -id_column id_column ] \
    [ -name_method name_method ]

Defined in /var/www/openacs.org/packages/xotcl-core/tcl/05-db-procs.tcl

Automatically generated method

Switches:
-dbn (optional)
-content_type (required)
-supertype (optional, defaults to "content_revision")
-pretty_name (required)
-pretty_plural (required)
-table_name (required)
-id_column (optional, defaults to "XXX")
-name_method (optional)

Testcases:
xotcl_core_tutorial_4
Source code:
#function_args: {CONTENT_TYPE {}} {SUPERTYPE content_revision} {PRETTY_NAME {}} {PRETTY_PLURAL {}} {TABLE_NAME {}} {ID_COLUMN XXX} {NAME_METHOD null}
foreach var [list CONTENT_TYPE SUPERTYPE PRETTY_NAME PRETTY_PLURAL TABLE_NAME ID_COLUMN NAME_METHOD]  {
  set varname [string tolower $var]
  if {[info exists $varname]} {
    set $var [set $varname]
    set _$var :$var
  } else {
    set _$var null
  }
}
set sql "
select content_type__create_type($_CONTENT_TYPE$_SUPERTYPE$_PRETTY_NAME$_PRETTY_PLURAL$_TABLE_NAME$_ID_COLUMN$_NAME_METHOD) 
    "
db_with_handle -dbn $dbn db {
  #ns_log notice "--sql=$sql"
  return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: