ad_dimensional_sql (public)

 ad_dimensional_sql option_list [ what ] [ joiner ] [ options_set ]

Defined in packages/acs-templating/tcl/dimensional-procs.tcl

Given what clause we are asking for and the joiner this returns the sql fragment

Parameters:
option_list (required)
the structure with the option data provided
what (optional, defaults to "where")
look for such keys in the option_list
joiner (optional, defaults to "and")
join string for combining multiple clauses
options_set (optional)
ns_set for reading variables
Returns:
SQL clause
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_dimensional ad_dimensional (test acs-templating) ad_dimensional_sql ad_dimensional_sql test_ad_dimensional->ad_dimensional_sql packages/acs-admin/www/apm/index.tcl packages/acs-admin/ www/apm/index.tcl packages/acs-admin/www/apm/index.tcl->ad_dimensional_sql packages/acs-admin/www/apm/version-parameters.tcl packages/acs-admin/ www/apm/version-parameters.tcl packages/acs-admin/www/apm/version-parameters.tcl->ad_dimensional_sql packages/general-comments/www/admin/index.tcl packages/general-comments/ www/admin/index.tcl packages/general-comments/www/admin/index.tcl->ad_dimensional_sql packages/news/www/admin/index.tcl packages/news/ www/admin/index.tcl packages/news/www/admin/index.tcl->ad_dimensional_sql

Testcases:
ad_dimensional
Source code:
    set out {}

    if {$option_list eq ""} {
        return
    }

    if {$options_set eq ""} {
        set options_set [ns_getform]
    }

    foreach option $option_list {
        # find out what the current option value is.
        # check if a default is set otherwise the first value is used
        set option_key [lindex $option 0]
        set option_val {}
        # get the option from the form
        if { $options_set ne ""} {
            set option_val [ns_set get $options_set $option_key]
        }
        #otherwise get from default
        if { $option_val eq "" } {
            set option_val [lindex $option 2]
        }

        foreach option_value [lindex $option 3] {
            set thisoption [lindex $option_value 0]
            if {$option_val eq $thisoption } {
                set code [lindex $option_value 2]
                if {$code ne ""} {
                    if {[lindex $code 0] eq $what } {
                        append out $joiner [uplevel [list subst [lindex $code 1]]]"
                    }
                }
            }
        }
    }

    return $out
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: