%3 ::xotcl::Object ::xotcl::Object → getExitHandler → setExitHandler → unsetExitHandler __object_configureparameter __timediff abstract ad_doc ad_forward ad_proc asHTML check class db_0or1row db_1row debug destroy_on_cleanup ds extractConfigureArg filter filtersearch forward hasclass init invar isclass ismetaclass ismixin isobject istype log method mixin mset msg parametercmd proc procsearch qn self serialize set_instance_vars_defaults unknown vwait www-show-object ::xo::db::SQL ::xo::db::SQL datatype_constraint date_trunc date_trunc_expression fix_function_args has_hstore has_ltree interval map_datatype map_function_name mk_sql_constraint_name select since_interval_condition sql_arg_info ::xo::db::SQL->::xotcl::Object ::xo::db::postgresql ::xo::db::postgresql date_trunc date_trunc_expression get_all_package_functions get_function_args has_hstore has_ltree map_datatype nextval select ::xo::db::postgresql->::xo::db::SQL ::xo::db::oracle ::xo::db::oracle datatype_constraint date_trunc date_trunc_expression limit_clause map_datatype map_function_name mk_sql_constraint_name nextval select ::xo::db::oracle->::xo::db::SQL ::xo::db::DB-postgresql ::xo::db::DB-postgresql 0or1row 1row dml foreach generate_psql get_value insert-view-operation list list_of_lists multirow prepare row_lock sets ::xo::db::DB-postgresql->::xo::db::postgresql ::xo::db::DB ::xo::db::DB ::xo::db::DB-postgresql->::xo::db::DB ::xo::db::DBI-postgresql ::xo::db::DBI-postgresql ::xo::db::DBI-postgresql->::xo::db::postgresql ::xo::db::DBI ::xo::db::DBI ::xo::db::DBI-postgresql->::xo::db::DBI ::xo::db::DB-oracle ::xo::db::DB-oracle generate_psql get_all_package_functions get_function_args sets ::xo::db::DB-oracle->::xo::db::oracle ::xo::db::DB-oracle->::xo::db::DB

Class ::xo::db::SQL

::xo::db::SQL[i] create ...

Defined in

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xotcl::Object[i]
  • subclass: ::xo::db::postgresql[i], ::xo::db::oracle[i]
::xotcl::Class create ::xo::db::SQL \
     -superclass ::xotcl::Object

Methods (to be applied on instances)

  • datatype_constraint (scripted)

     <instance of xo::db::SQL[i]> datatype_constraint

    Testcases:
    xotcl_core_tutorial_2, xotcl-core
    return ""
  • date_trunc (scripted)

    if {![::xotcl::self isnextcall]} {
      error "Abstract method date_trunc type called"
    } else {::xotcl::next}
  • date_trunc_expression (scripted)

    if {![::xotcl::self isnextcall]} {
      error "Abstract method date_trunc_expression type called"
    } else {::xotcl::next}
  • fix_function_args (scripted)

    #
    # Load fallback defaults for buggy function args. The values
    # provided here are only used for function args without specified
    # defaults. This is a transitional solution; actually, the
    # function args should be fixed.
    #
    
    if {![::xo::db::SQL exists fallback_defaults(${package_name}__$object_name)]} {
      return $function_args
    }
    array set additional_defaults [::xo::db::SQL set fallback_defaults(${package_name}__$object_name)]
    set result {}
    foreach arg $function_args {
      lassign $arg arg_name default_value
      if {$default_value eq "" && [info exists additional_defaults($arg_name)]} {
        lappend result [list $arg_name $additional_defaults($arg_name)]
      } else {
        lappend result [list $arg_name $default_value]
      }
    }
    return $result
  • has_hstore (scripted)

    return 0
  • has_ltree (scripted)

    return 0
  • interval (scripted)

    return [clock format [clock scan "-$interval"] -format "%Y-%m-%d %T"]
  • map_datatype (scripted)

    #
    # Map a generic datatype to a real datatype of the underlying
    # database management system. This function is typically refined
    # for concrete database systems.
    #
    # If a mapping is not found we keep the type unaltered, but this
    # will currently break acs_attributes_datatype_fk when creating
    # acs_attributes with an unmapped type.
    return [::xo::dc get_value map "
     select database_type from acs_datatypes
      where datatype = :type" $type]
  • map_function_name (scripted)

    return $sql
  • mk_sql_constraint_name (scripted)

    return ${table}_${att}_$suffix
  • select (scripted)

    if {![::xotcl::self isnextcall]} {
      error "Abstract method select type called"
    } else {::xotcl::next}
  • since_interval_condition (scripted)

    set since '[clock format [clock scan "-$interval"] -format "%Y-%m-%d %T"]'
    return "$var > TO_TIMESTAMP($since,'YYYY-MM-DD HH24:MI:SS')"
  • sql_arg_info (scripted)

    set defined {}
    set psql_args [list]
    set arg_order [list]
    foreach arg $function_args {
      lassign $arg arg_name default_value
      lappend psql_args \$_$arg_name
      lappend arg_order $arg_name
      lappend defined $arg_name $default_value
    }
    return [list  psql_args     [join $psql_args ", "]  arg_order     $arg_order  defined       $defined  function_args $function_args]