- Publicity: Public Only All
plsql-utility-procs.tcl
Procs to help generate pl/sql dynamically
- Location:
- packages/acs-subsite/tcl/plsql-utility-procs.tcl
- Created:
- Thu Dec 7 10:31:56 2000
- Author:
- mbryzek@arsdigita.com
- CVS Identification:
$Id: plsql-utility-procs.tcl,v 1.9.2.4 2021/03/06 20:01:30 gustafn Exp $
Procedures in this file
- plsql_utility::generate_attribute_dml (public)
- plsql_utility::generate_attribute_parameter_call (public)
- plsql_utility::generate_attribute_parameter_call_from_attributes (public)
- plsql_utility::generate_attribute_parameters (public)
- plsql_utility::generate_constraint_name (public)
- plsql_utility::generate_oracle_name (public)
- plsql_utility::object_type_exists_p (public)
- plsql_utility::parse_sql (public)
Detailed information
plsql_utility::generate_attribute_dml (public)
plsql_utility::generate_attribute_dml \ [ -start_with_comma start_with_comma ] [ -prepend prepend ] \ [ -ignore ignore ] table_name attr_list
Generates the string for a sql insert... e.g. ",col1, col2"
- Switches:
- -start_with_comma (optional, defaults to
"t"
)- -prepend (optional)
- -ignore (optional)
- Parameters:
- table_name (required)
- attr_list (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::generate_attribute_parameter_call (public)
plsql_utility::generate_attribute_parameter_call [ -prepend prepend ] \ [ -indent indent ] pairs
Generates the arg list for a call to a pl/sql function or procedure
- Switches:
- -prepend (optional)
- -indent (optional, defaults to
"9"
)- Parameters:
- pairs (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::generate_attribute_parameter_call_from_attributes (public)
plsql_utility::generate_attribute_parameter_call_from_attributes \ [ -prepend prepend ] [ -indent indent ] attr_list
Wrapper for generate_attribute_parameter_call that formats default attribute list to the right format.
- Switches:
- -prepend (optional)
- -indent (optional, defaults to
"9"
)- Parameters:
- attr_list (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::generate_attribute_parameters (public)
plsql_utility::generate_attribute_parameters [ -indent indent ] \ attr_list
Generates the arg list to a pl/sql function or procedure
- Switches:
- -indent (optional, defaults to
"9"
)- Parameters:
- attr_list (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::generate_constraint_name (public)
plsql_utility::generate_constraint_name [ -max_length max_length ] \ table column stem
Generates a constraint name adhering to the arsdigita standard for naming constraints. Note that this function does not yet ensure that the returned constraint name is not already in use, though the probability for a collision is pretty low. The ideal name is table_column_stem. We trim first table, then column to make it fit.
- Switches:
- -max_length (optional, defaults to
"30"
)- Parameters:
- table (required)
- column (required)
- stem (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::generate_oracle_name (public)
plsql_utility::generate_oracle_name [ -max_length max_length ] \ [ -include_object_id include_object_id ] stem
Returns an object name of max_length characters, in lowercase, beginning with stem but without any unsafe characters. Only allowed characters are numbers, letter, underscore, dash and space, though the returned word will start with a letter. Throws an error if no safe name could be generated. To almost guarantee uniqueness, you can use the next object_id from acs_object_id_seq as the tail of the name we return.
- Switches:
- -max_length (optional, defaults to
"30"
)- -include_object_id (optional, defaults to
"f"
)- Parameters:
- stem (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::object_type_exists_p (public)
plsql_utility::object_type_exists_p object_type
Returns 1 if the specified object_type exists. 0 otherwise.
- Parameters:
- object_type (required)
- Author:
- Michael Bryzek <mbryzek@arsdigita.com>
- Created:
- 11/2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
plsql_utility::parse_sql (public)
plsql_utility::parse_sql sql_query
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.