xo::db::sql::acs_attribute proc create_attribute (public)
xo::db::sql::acs_attribute create_attribute [ -dbn dbn ] \ -object_type object_type -attribute_name attribute_name \ -datatype datatype -pretty_name pretty_name \ [ -pretty_plural pretty_plural ] [ -table_name table_name ] \ [ -column_name column_name ] [ -default_value default_value ] \ [ -min_n_values min_n_values ] [ -max_n_values max_n_values ] \ [ -sort_order sort_order ] [ -storage storage ] \ [ -static_p static_p ] [ -create_column_p create_column_p ] \ [ -database_type database_type ] [ -size size ] [ -null_p null_p ] \ [ -references references ] [ -check_expr check_expr ] \ [ -column_spec column_spec ]
Defined in /var/www/openacs.org/packages/xotcl-core/tcl/05-db-procs.tcl
Automatically generated method
- Switches:
- -dbn (optional)
- -object_type (required)
- -attribute_name (required)
- -datatype (required)
- -pretty_name (required)
- -pretty_plural (optional)
- -table_name (optional)
- -column_name (optional)
- -default_value (optional)
- -min_n_values (optional, defaults to
"1"
)- -max_n_values (optional, defaults to
"1"
)- -sort_order (optional)
- -storage (optional, defaults to
"type_specific"
)- -static_p (optional, defaults to
"f"
)- -create_column_p (optional, defaults to
"f"
)- -database_type (optional)
- -size (optional)
- -null_p (optional, defaults to
"t"
)- -references (optional)
- -check_expr (optional)
- -column_spec (optional)
- Testcases:
- xotcl_core_tutorial_2
Source code: #function_args: {OBJECT_TYPE {}} {ATTRIBUTE_NAME {}} {DATATYPE {}} {PRETTY_NAME {}} {PRETTY_PLURAL null} {TABLE_NAME null} {COLUMN_NAME null} {DEFAULT_VALUE null} {MIN_N_VALUES 1} {MAX_N_VALUES 1} {SORT_ORDER null} {STORAGE type_specific} {STATIC_P f} {CREATE_COLUMN_P f} {DATABASE_TYPE null} {SIZE null} {NULL_P t} {REFERENCES null} {CHECK_EXPR null} {COLUMN_SPEC null} foreach var [list OBJECT_TYPE ATTRIBUTE_NAME DATATYPE PRETTY_NAME PRETTY_PLURAL TABLE_NAME COLUMN_NAME DEFAULT_VALUE MIN_N_VALUES MAX_N_VALUES SORT_ORDER STORAGE STATIC_P CREATE_COLUMN_P DATABASE_TYPE SIZE NULL_P REFERENCES CHECK_EXPR COLUMN_SPEC] { set varname [string tolower $var] if {[info exists $varname]} { set $var [set $varname] set _$var :$var } else { set _$var null } } set sql " select acs_attribute__create_attribute($_OBJECT_TYPE, $_ATTRIBUTE_NAME, $_DATATYPE, $_PRETTY_NAME, $_PRETTY_PLURAL, $_TABLE_NAME, $_COLUMN_NAME, $_DEFAULT_VALUE, $_MIN_N_VALUES, $_MAX_N_VALUES, $_SORT_ORDER, $_STORAGE, $_STATIC_P, $_CREATE_COLUMN_P, $_DATABASE_TYPE, $_SIZE, $_NULL_P, $_REFERENCES, $_CHECK_EXPR, $_COLUMN_SPEC) " 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