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):
%3 group_type::new group_type::new (public) plsql_utility::parse_sql plsql_utility::parse_sql group_type::new->plsql_utility::parse_sql ns_dbquotevalue ns_dbquotevalue plsql_utility::parse_sql->ns_dbquotevalue

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_query
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: