xo::db::sql::util proc foreign_key_exists (public)

 xo::db::sql::util[i] foreign_key_exists [ -dbn dbn ] \
    -table_name table_name  -column column  -reftable reftable  \
    -refcolumn refcolumn 

Defined in packages/xotcl-core/tcl/05-db-procs.tcl

Automatically generated method

Switches:
-dbn
(optional)
-table_name
(required)
-column
(required)
-reftable
(required)
-refcolumn
(required)

Partial Call Graph (max 5 caller/called nodes):
%3 db_with_handle db_with_handle (public) xo::db::sql::util proc foreign_key_exists xo::db::sql::util proc foreign_key_exists xo::db::sql::util proc foreign_key_exists->db_with_handle

Testcases:
No testcase defined.
Source code:
#function_args: {TABLE_NAME {}} {COLUMN {}} {REFTABLE {}} {REFCOLUMN {}}
foreach var [list TABLE_NAME COLUMN REFTABLE REFCOLUMN]  {
  set varname [string tolower $var]
  if {[info exists $varname]} {
    set $var [set $varname]
    set _$var :$var
  } else {
    set _$var null
  }
}
set sql "
select util__foreign_key_exists($_TABLE_NAME$_COLUMN$_REFTABLE$_REFCOLUMN) 
    "
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: