plsql_utility::parse_sql (public)
plsql_utility::parse_sql sql_query
Defined in packages/acs-subsite/tcl/plsql-utility-procs.tcl
Replaces bind variables with their Double Apos'd values to aid in debugging. Throws error if any bind variable is undefined in the calling environment.
Limits: Only handles letter, numbers, and _ or - in bind variable names
Example:
set group_id -2 set sql {select acs_group.name(:group_id) from dual} ns_write [plsql_utility::parse_sql $sql]would write the following to the browser:select acs_group.name('-2') from dual
- Parameters:
- sql_query (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: while { 1 } { if { ![regexp -- {:([a-zA-Z0-9_-]+)} $sql_query match var] } { break } # Use $var as the target to get nice error messages upvar 1 $var $var if { ![info exists $var] } { error "Cannot find value for bind variable \"$var\"\n\n" } regsub -- "\:$var" $sql_query [::ns_dbquotevalue [set $var]] sql_query } return $sql_queryXQL Not present: Generic, PostgreSQL, Oracle