xo::db::require proc unique (public)
xo::db::requireunique [ -table table ] [ -col col ]
Defined in /var/www/openacs/packages/xotcl-core/tcl/05-db-procs.tcl
Add a uniqueness constraint unless the column already has a matching constraint or conventionally named unique index.
- Switches:
- -table (optional)
- Table to alter.
- -col (optional)
- Column name.
- Testcases:
- xotcl_core_tutorial_2
Source code: # Unique could be there by an index too set idxname [::xo::dc mk_sql_constraint_name $table $col un_idx] if {[::acs::dc call util index_exists -name $idxname]} return if {![::acs::dc call util unique_exists -table $table -column $col]} { ::xo::dc dml alter-table-$table "alter table $table add unique ($col)" }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)