acs::db::nsdb-postgresql method build_psql_body (protected)

 <instance of acs::db::nsdb-postgresql[i]> build_psql_body tcl sql \
    result_type

Defined in packages/acs-tcl/tcl/00-acs-tcl-init.tcl

Parameters:
tcl (required)
sql (required)
result_type (required)

Testcases:
No testcase defined.
Source code:
if {$result_type eq "record"} {
    return [ns_trim -delimiter | [string map [list @SQL@ $sql] {
        | set result {}; set start_time [expr {[clock clicks -microseconds]/1000.0}]
        | db_with_handle -dbn $dbn __DB {
        |    set s [ns_pg_bind select $__DB {select r.* from @SQL@ as r}]
        |    while {[ns_db getrow $__DB $s]} {lappend result [ns_set values $s]}
        | }
        | ds_collect_db_call $dbn call "" "@SQL@" $start_time 0 ""
        | ns_set free $s
        | return $result
    }]]
} else {
    return [ns_trim -delimiter | [string map [list @SQL@ $sql] {
        | db_with_handle -dbn $dbn __DB {
        |    set s [ns_pg_bind 0or1row $__DB {select @SQL@}]
        |    return [ns_set value $s 0]
        | }
    }]]
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: