template::query::nestedlist (private)

 template::query::nestedlist statement_name db result_name sql

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

Creates a data source where the values for each row are returned as a list. Rows are grouped according to the column values specified in the -groupby option See template::util::lnest for more details.

Parameters:
statement_name - Standard db_api statement name used to hook into query dispatcher
db - Database handle
result_name - Tcl variable name to use when setting the result
sql - Query to use when processing this command

Partial Call Graph (max 5 caller/called nodes):
%3 db_exec db_exec (public) template::util::lnest template::util::lnest (public) template::query::nestedlist template::query::nestedlist template::query::nestedlist->db_exec template::query::nestedlist->template::util::lnest

Testcases:
No testcase defined.
Source code:

    upvar opts opts

    set row [db_exec select $db $statement_name $sql 3]

    upvar $opts(uplevel) $result_name rows

    set groups $opts(groupby)

    set rows {}

    while { [ns_db getrow $db $row] } {

        set values [ns_set values $row]

        # build the values on which to group
        set group_values [list]
        foreach group $groups {
            lappend group_values [ns_set get $row $group]
        }

        template::util::lnest rows $values {*}$group_values
    }

    if { [info exists opts(cache)] } {
        set opts(result) $rows
    }

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