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

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

Defined in

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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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 (optional, defaults to "true")

    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)

    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)

    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 (optional, defaults to "true")

    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)

    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 ]
    }

Variables

::xo::db::sql::util set __default_metaclass ::xotcl::Class
::xo::db::sql::util set __default_superclass ::xotcl::Object
::xo::db::sql::util set abstract_p f
::xo::db::sql::util set auto_save false
::xo::db::sql::util set name_method {}
::xo::db::sql::util set object_type ::xo::db::sql::util
::xo::db::sql::util set security_inherit_p t
::xo::db::sql::util set sql_package_name util
::xo::db::sql::util set supertype acs_object
::xo::db::sql::util set with_table true