Defined in
- Testcases:
-
xotcl_core_tutorial_2, xotcl-core
Source code:
if {![info exists col] && ![info exists expression]} {
error "Neither col nor expression were provided"
}
if { [info exists col] && [info exists expression]} {
error "Please provide either col or expression"
}
if {[info exists col]} {
set colExpSQL $col
regsub -all -- ", *" $col _ colExpName
} else {
set colExpSQL ($expression)
if {[info exists expression_name]} {
set colExpName $expression_name
} else {
regsub -all -- {[^[:alnum:]]} $expression "" colExpName
}
}
set suffix [expr {$unique ? "un_idx" : "idx"}]
set uniquepart [expr {$unique ? "UNIQUE" : ""}]
set name [::xo::dc mk_sql_constraint_name $table $colExpName $suffix]
if {![::acs::dc call util index_exists -name $name]} {
if {[db_driverkey ""] eq "oracle"} {set using ""}
set using [expr {$using ne "" ? "using $using" : ""}]
::xo::dc dml create-index-$name "create $uniquepart index $name ON $table $using ($colExpSQL)"
}
XQL Not present:Generic, PostgreSQL, Oracle