xotcl.wu-wien.ac.at
Begin main content
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xotcl::Object[i] ::xo::db::sql

::xotcl::Object create ::xo::db::sql

Methods

  • proc datatype_constraint

    ::254868 proc datatype_constraint {type table att} {
          # for postgres, we do not need type specific constraints
          return ""
        }
    
  • proc date_trunc

    ::254868 proc date_trunc {field date} {
          return "date_trunc('$field',$date)"
        }
    
  • proc date_trunc_expression

    ::254868 proc date_trunc_expression {field date date_string} {
          return "date_trunc('$field',$date) = '$date_string'"
        }
    
  • proc map_datatype

    ::254868 proc map_datatype type {
          switch -- $type {
            string    { set type text }
            long_text { set type text }
            date      { set type "timestamp with time zone" }
            ltree     { set type [expr {[::xo::db::has_ltree] ? "ltree" : "text" }] }
          }
          return $type
        }
    
  • proc map_function_name

    ::254868 proc map_function_name sql {
          return $sql
        }
    
  • proc select

    ::254868 proc select {-vars:required -from:required {-where ""} {-groupby ""} {-limit ""} {-offset ""} {-start ""} {-orderby ""} {-map_function_names false}} {
          set where_clause  [expr {$where   ne "" ? "WHERE $where" : ""}]
          set offset_clause [expr {$offset  ne "" ? "OFFSET $offset" : ""}]
          set limit_clause  [expr {$limit   ne "" ? "LIMIT $limit" : ""}]
          set order_clause  [expr {$orderby ne "" ? "ORDER BY $orderby" : ""}]
          set group_clause  [expr {$groupby ne "" ? "GROUP BY $groupby" : ""}]
          return "SELECT $vars FROM $from $where_clause $group_clause $order_clause $limit_clause $offset_clause"
        }
    
  • proc since_interval_condition

    ::254868 proc since_interval_condition {var interval} {
        set since [clock format [clock scan "-$interval"] -format "%Y-%m-%d %T"]
        return "$var > TO_TIMESTAMP('$since','YYYY-MM-DD HH24:MI:SS')"
      }
    

Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]