acs::db::nsdb-oracle method build_psql_body (protected)
<instance of acs::db::nsdb-oracle> build_psql_body tcl sql \ result_type
Defined in packages/acs-tcl/tcl/acs-db-12-procs.tcl
- Parameters:
- tcl (required)
- sql (required)
- result_type (required)
- Testcases:
- No testcase defined.
Source code: if {$result_type eq ""} { # # Call an SQL procedure. # set sql [subst {BEGIN $sql; END;}] set sql_cmd [subst {ns_ora dml \$__DB \[subst {$sql}\]}] } elseif {$result_type eq "TABLE"} { # # Function returning a table # return [ns_trim -delimiter | [string map [list @SQL@ $sql @TCL@ $tcl] { | @TCL@; set result {}; set start_time [expr {[clock clicks -microseconds]/1000.0}] | db_with_handle -dbn $dbn __DB { | set s [ns_ora select $__DB [subst {select * from @SQL@}]] | 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 { # # Call an SQL function returning a scalar. # set sql [subst {BEGIN :1 := $sql; END;}] set sql_cmd [subst {ns_ora exec_plsql_bind \$__DB \[subst {$sql}\] 1 {}}] } return [ns_trim -delimiter | [subst { |$tcl |db_with_handle -dbn \$dbn __DB { | ns_log notice "Oracle: $sql_cmd" | return \[ $sql_cmd \] |} }]]XQL Not present: Generic, PostgreSQL, Oracle