plpgsql_utility::generate_attribute_parameter_call (public)

 plpgsql_utility::generate_attribute_parameter_call \
    [ -prepend prepend ] function_name pairs

Defined in packages/acs-subsite/tcl/plpgsql-utility-procs.tcl

Generates the arg list for a call to a pl/pgsql function

Switches:
-prepend
(optional)
Parameters:
function_name
pairs
Author:
Steve Woodcock <swoodcock@scholastic.co.uk>
Created:
07/2001

Partial Call Graph (max 5 caller/called nodes):
%3 package_instantiate_object package_instantiate_object (public) plpgsql_utility::generate_attribute_parameter_call plpgsql_utility::generate_attribute_parameter_call package_instantiate_object->plpgsql_utility::generate_attribute_parameter_call plpgsql_utility::generate_attribute_parameter_call_from_attributes plpgsql_utility::generate_attribute_parameter_call_from_attributes (public) plpgsql_utility::generate_attribute_parameter_call_from_attributes->plpgsql_utility::generate_attribute_parameter_call plpgsql_utility::get_function_args plpgsql_utility::get_function_args (private) plpgsql_utility::generate_attribute_parameter_call->plpgsql_utility::get_function_args util_memoize util_memoize (public) plpgsql_utility::generate_attribute_parameter_call->util_memoize

Testcases:
No testcase defined.
Source code:
        # Get the list of real args to the function
        set real_args [util_memoize [list plpgsql_utility::get_function_args $function_name]]

        foreach row $pairs {
            set attr [string trim [lindex $row 0]]
            set user_supplied([string toupper $attr]) $attr
        }

        # This list of reserved default values is needed so we don't
        # try to quote them. A better alternative might be to use some
        # notion of datatype (e.g. using
        # information_schema.parameters) and take an informed decision
        # based on this.
        set reserved_default_values {
            current_date
            current_timestamp
        }

        # For each real arg, append default or supplied arg value
        set pieces [list]
        foreach row $real_args {
            lassign $row arg_name arg_default

            if { [info exists user_supplied($arg_name)] } {
                lappend pieces "${prepend}$user_supplied($arg_name)"
            } elseif$arg_default eq "" || $arg_default eq "null"} {
                lappend pieces "NULL"
            } elseif { [string tolower $arg_default] ni $reserved_default_values } {
                lappend pieces [ns_dbquotevalue $arg_default]
            } else {
                lappend pieces $arg_default
            }
        }

        return [join $pieces ","]
XQL Not present:
Generic, Oracle
PostgreSQL XQL file:
packages/acs-subsite/tcl/plpgsql-utility-procs-postgresql.xql

[ hide source ] | [ make this the default ]
Show another procedure: