Class ::xo::db::sql::util

::xo::db::sql::util[i] create ...

Class Relations

  • class: ::xo::db::Class[i]
  • superclass: ::xotcl::Object[i]
::xo::db::Class create ::xo::db::sql::util \
     -superclass ::xotcl::Object

Methods (to be applied on the object)

  • computehash (scripted, public)

     xo::db::sql::util[i] computehash [ -dbn dbn ] -value value 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -value
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {VALUE {}}
    foreach var [list VALUE]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__computehash($_VALUE) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • computehash_raw (scripted, public)

     xo::db::sql::util[i] computehash_raw [ -dbn dbn ] -arg arg 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -arg
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {ARG {}}
    foreach var [list ARG]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__computehash_raw($_ARG) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • foreign_key_exists (scripted, public)

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

    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.
    #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 ]
    }
  • get_default (scripted, public)

     xo::db::sql::util[i] get_default [ -dbn dbn ] -table_name table_name  \
        -column column 

    Automatically generated method

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

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

    Testcases:
    No testcase defined.
    #function_args: {TABLE_NAME {}} {COLUMN {}}
    foreach var [list TABLE_NAME COLUMN]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__get_default($_TABLE_NAME$_COLUMN) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • get_primary_keys (scripted, public)

     xo::db::sql::util[i] get_primary_keys [ -dbn dbn ] \
        -table_name table_name 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -table_name
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {TABLE_NAME {}}
    foreach var [list TABLE_NAME]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__get_primary_keys($_TABLE_NAME) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • index_exists (scripted, public)

     xo::db::sql::util[i] index_exists [ -dbn dbn ] -name name 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -name
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {NAME {}}
    foreach var [list NAME]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__index_exists($_NAME) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • logical_negation (scripted, public)

     xo::db::sql::util[i] logical_negation [ -dbn dbn ] \
        -true_or_false true_or_false 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -true_or_false
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {TRUE_OR_FALSE {}}
    foreach var [list TRUE_OR_FALSE]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__logical_negation($_TRUE_OR_FALSE) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • multiple_nextval (scripted, public)

     xo::db::sql::util[i] multiple_nextval [ -dbn dbn ] \
        -v_sequence_name v_sequence_name  -v_count v_count 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -v_sequence_name
    (required)
    -v_count
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {V_SEQUENCE_NAME {}} {V_COUNT {}}
    foreach var [list V_SEQUENCE_NAME V_COUNT]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__multiple_nextval($_V_SEQUENCE_NAME$_V_COUNT) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • not_null_exists (scripted, public)

     xo::db::sql::util[i] not_null_exists [ -dbn dbn ] -table_name table_name  \
        -column column 

    Automatically generated method

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

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

    Testcases:
    No testcase defined.
    #function_args: {TABLE_NAME {}} {COLUMN {}}
    foreach var [list TABLE_NAME COLUMN]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__not_null_exists($_TABLE_NAME$_COLUMN) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • primary_key_exists (scripted, public)

     xo::db::sql::util[i] primary_key_exists [ -dbn dbn ] \
        -table_name table_name  -column column  [ -single_p single_p ]

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -table_name
    (required)
    -column
    (required)
    -single_p
    (defaults to "true") (optional)

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

    Testcases:
    No testcase defined.
    #function_args: {TABLE_NAME {}} {COLUMN {}} {SINGLE_P true}
    foreach var [list TABLE_NAME COLUMN SINGLE_P]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__primary_key_exists($_TABLE_NAME$_COLUMN$_SINGLE_P) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • table_column_exists (scripted, public)

     xo::db::sql::util[i] table_column_exists [ -dbn dbn ] \
        -table_name table_name  -column column 

    Automatically generated method

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

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

    Testcases:
    No testcase defined.
    #function_args: {TABLE_NAME {}} {COLUMN {}}
    foreach var [list TABLE_NAME COLUMN]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__table_column_exists($_TABLE_NAME$_COLUMN) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • table_exists (scripted, public)

     xo::db::sql::util[i] table_exists [ -dbn dbn ] -name name 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -name
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {NAME {}}
    foreach var [list NAME]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__table_exists($_NAME) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • unique_exists (scripted, public)

     xo::db::sql::util[i] unique_exists [ -dbn dbn ] -table table  \
        -column column  [ -single_p single_p ]

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -table
    (required)
    -column
    (required)
    -single_p
    (defaults to "true") (optional)

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

    Testcases:
    No testcase defined.
    #function_args: {TABLE {}} {COLUMN {}} {SINGLE_P true}
    foreach var [list TABLE COLUMN SINGLE_P]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__unique_exists($_TABLE$_COLUMN$_SINGLE_P) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }
  • view_exists (scripted, public)

     xo::db::sql::util[i] view_exists [ -dbn dbn ] -name name 

    Automatically generated method

    Switches:
    -dbn
    (optional)
    -name
    (required)

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

    Testcases:
    No testcase defined.
    #function_args: {NAME {}}
    foreach var [list NAME]  {
      set varname [string tolower $var]
      if {[info exists $varname]} {
        set $var [set $varname]
        set _$var :$var
      } else {
        set _$var null
      }
    }
    set sql "
    select util__view_exists($_NAME) 
        "
    db_with_handle -dbn $dbn db {
      #ns_log notice "--sql=$sql"
      return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
    }