template::get_datasources (public)

 template::get_datasources code

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

Assemble directives into data source(s) for presentation.

Parameters:
code (required)

Partial Call Graph (max 5 caller/called nodes):
%3 template::parse_directives template::parse_directives (public) template::get_datasources template::get_datasources template::get_datasources->template::parse_directives

Testcases:
No testcase defined.
Source code:

    upvar datasources:rowcount rowcount
    set rowcount 0

    #for debugging purposes
    upvar output text
    set text [parse_directives $code]

    foreach directive [parse_directives $code] {

        switch -exact [lindex $directive 0] {

            datasource {

                # directive is a new datasource
                set info [lindex $directive 1]
                # Assign the first elements of $info to 'name' and 'structure',
                # and the rest to 'comment'
                set comment [lassign $info name structure]

                if { [string match "one*" $structure] } {

                    # directive is a onevalue or onelist.  add a row and move on
                    incr rowcount
                    upvar datasources:$rowcount datasource

                    set datasource(rownum) $rowcount
                    set datasource(name) $name
                    set datasource(structure) $structure
                    set datasource(comment) $comment
                }
            }

            data_input {
                # directive is a new form
                set info [lindex $directive 1]
                # Assign the first elements of $info to 'name' and 'structure',
                # and the rest to 'comment'
                set comment [lassign $info name structure]
            }

            input {
                set info [lindex $directive 1]
                # Assign the first elements of $info to 'input_name' and
                # 'input_type', and the rest to 'input_comment'
                set input_comment [lassign $info input_name input_type]

                incr rowcount
                upvar datasources:$rowcount datasource

                set datasource(rownum) $rowcount
                set datasource(structure) $structure
                set datasource(comment) $comment
                set datasource(name) $name

                set datasource(input_name) $input_name
                set datasource(input_type) $input_type
                set datasource(input_comment) $input_comment
            }

            column {
                set info [lindex $directive 1]
                # Assign the first element of $info to 'column_name', and the
                # rest to 'column_comment'
                set column_comment [lassign $info column_name]

                incr rowcount
                upvar datasources:$rowcount datasource

                set datasource(rownum) $rowcount
                set datasource(name) $name
                set datasource(structure) $structure
                set datasource(comment) $comment

                set datasource(column_name) $column_name
                set datasource(column_comment) $column_comment
            }
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: