- Publicity: Public Only All
acs-db-12-procs.tcl
Low level interface for defining interface stubs to application specific DB functions.
This file defines the following Objects and Classes: ::acs::db::postgresql, ::acs::db::nsdb-oracle, ::acs::db::SQL, ::acs::db::nsdbi-postgresql, ::acs::db::oracle, ::acs::db::SQL, ::acs::db::SQL, ::acs::db::SQL, ::acs::db::SQL, ::acs::db::SQL, ::acs::db::SQL, ::acs::db::nsdb-oracle, ::acs::db::nsdbi-postgresql, ::acs::db::oracle, ::acs::db::oracle, ::acs::db::oracle, ::acs::db::oracle, ::acs::db::oracle, ::acs::db::oracle, ::acs::db::oracle, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::postgresql, ::acs::db::SQL
- Location:
- packages/acs-tcl/tcl/acs-db-12-procs.tcl
- Created:
- 2022-02-07
- Author:
- Gustaf Neumann
Procedures in this file
- Class ::acs::db::SQL (public)
- Class ::acs::db::nsdb-oracle (public)
- Class ::acs::db::nsdbi-postgresql (public)
- Class ::acs::db::oracle (public)
- Class ::acs::db::postgresql (public)
- acs::db::SQL instproc build_function_argument_list (protected)
- acs::db::SQL instproc build_stub_body (protected)
- acs::db::SQL instproc create_db_function_interface (public)
- acs::db::SQL instproc dbfunction_argument_value (protected)
- acs::db::SQL instproc dbfunction_to_tcl (protected)
- acs::db::SQL instproc dbproc_arg (protected)
- acs::db::nsdb-oracle instproc build_psql_body (protected)
- acs::db::nsdbi-postgresql instproc build_psql_body (protected)
- acs::db::oracle instproc db_proc_opt_arg_spec (protected)
- acs::db::oracle instproc expected_result_types (protected)
- acs::db::oracle instproc get_all_package_functions (public)
- acs::db::oracle instproc map_function_name (public)
- acs::db::oracle instproc sql_function_argument_list (protected)
- acs::db::oracle instproc sql_function_name (protected)
- acs::db::oracle instproc typemap (protected)
- acs::db::postgresql instproc argument_name_match (protected)
- acs::db::postgresql instproc db_proc_opt_arg_spec (protected)
- acs::db::postgresql instproc expected_result_types (protected)
- acs::db::postgresql instproc get_all_package_functions (public)
- acs::db::postgresql instproc map_function_name (public)
- acs::db::postgresql instproc psql_statement_suffix (protected)
- acs::db::postgresql instproc sql_function_argument_list (protected)
- acs::db::postgresql instproc sql_function_name (protected)
- acs::db::postgresql instproc typemap (protected)
Detailed information
Class ::acs::db::SQL (public)
::nx::Class ::acs::db::SQL
Generic superclass for all SQL dialects.
- Testcases:
- No testcase defined.
Class ::acs::db::nsdb-oracle (public)
::nx::Class ::acs::db::nsdb-oracle
Oracle backend for nsdb driver
- Testcases:
- No testcase defined.
Class ::acs::db::nsdbi-postgresql (public)
::nx::Class ::acs::db::nsdbi-postgresql
PostgreSQL backend for nsdbi driver
- Testcases:
- No testcase defined.
Class ::acs::db::oracle (public)
::nx::Class ::acs::db::oracle
Support class for backend based on Oracle, i.e., the Oracle dialect of SQL).. This class can be used with the nsdb and the nsdbi drivers of NaviServer.
- Testcases:
- No testcase defined.
Class ::acs::db::postgresql (public)
::nx::Class ::acs::db::postgresql
Support class for backend based on PostgreSQL, i.e., the PostgreSQL dialect of SQL). This class can be used with the nsdb and the nsdbi drivers of NaviServer.
- Testcases:
- No testcase defined.
acs::db::SQL method build_function_argument_list (protected)
<instance of acs::db::SQL> build_function_argument_list dict
Return argument list as used for procs and methods. Different backend provide data in different forms (types, meta model data), so we use in the case of Oracle a dict with the assembled data and we normalize to common grounds here.
- Parameters:
- dict (required)
- Testcases:
- No testcase defined.
acs::db::SQL method build_stub_body (protected)
<instance of acs::db::SQL> build_stub_body package_name \ object_name sql_info
Generate stub for calling the DB function.
- Parameters:
- package_name (required)
- object_name (required)
- sql_info (required)
- Testcases:
- No testcase defined.
acs::db::SQL method create_db_function_interface (public)
<instance of acs::db::SQL> create_db_function_interface \ [ -dbn dbn ] [ -match match ] [ -verbose ]
Obtain all function definitions from the DB and turn these into callable Tcl methods like the following examples: ::acs::dc call content_type drop_type -content_type ::xowiki::FormInstance ::acs::dc call content_folder delete -folder_id $root_folder_id -cascade_p 1 In the Oracle-biased terminology such calls are defined in terms of a "package_name" and an "object_name": ::acs::dc call /package_name/ /object_name/ ?/args/?
- Switches:
- -dbn (optional)
- -match (optional, defaults to
"*"
)- -verbose (optional)
- Testcases:
- No testcase defined.
acs::db::SQL method dbfunction_argument_value (protected)
<instance of acs::db::SQL> dbfunction_argument_value \ [ -name name ] [ -type type ]
- Switches:
- -name (optional)
- -type (optional)
- Testcases:
- No testcase defined.
acs::db::SQL method dbfunction_to_tcl (protected)
<instance of acs::db::SQL> dbfunction_to_tcl [ -verbose ] \ package_name object_name sql_info
This method compiles a stored procedure into proc using a classic nonpositional argument style interface.
- Switches:
- -verbose (optional)
- Parameters:
- package_name (required)
- object_name (required)
- sql_info (required)
- Testcases:
- No testcase defined.
acs::db::SQL method dbproc_arg (protected)
<instance of acs::db::SQL> dbproc_arg -name name -type type \ [ -required ] [ -allow_empty ]
- Switches:
- -name (required)
- -type (required)
- -required (optional)
- -allow_empty (optional)
- Testcases:
- No testcase defined.
acs::db::nsdb-oracle method build_psql_body (protected)
<instance of acs::db::nsdb-oracle> build_psql_body tcl sql \ result_type
- Parameters:
- tcl (required)
- sql (required)
- result_type (required)
- Testcases:
- No testcase defined.
acs::db::nsdbi-postgresql method build_psql_body (protected)
<instance of acs::db::nsdbi-postgresql> build_psql_body tcl sql \ result_type
- Parameters:
- tcl (required)
- sql (required)
- result_type (required)
- Testcases:
- No testcase defined.
acs::db::oracle method db_proc_opt_arg_spec (protected)
<instance of acs::db::oracle> db_proc_opt_arg_spec \ [ -name name ] [ -type type ] [ -default default ]
- Switches:
- -name (optional)
- -type (optional)
- -default (optional)
- Testcases:
- No testcase defined.
acs::db::oracle method expected_result_types (protected)
<instance of acs::db::oracle> expected_result_types
Be aware: DATE is just a date (without a time part), e.g. ::acs::dc call content_item get_publish_date -item_id ...
- Testcases:
- No testcase defined.
acs::db::oracle method get_all_package_functions (public)
<instance of acs::db::oracle> get_all_package_functions \ [ -dbn dbn ]
Get all package functions (package name, object name) from Oracle system catalogs. The resulting list contains entries of the form: sqlpackage object {argument_names ... types ... defaulted ... result_type ....} Note that the method processes only the functions and procedures created by the current USER, which is in the default configuration the user "OPENACS". This way, we cover only these functions defined by OpenACS. This has a similar functionality like the "function_args" in PostgreSQL.
- Switches:
- -dbn (optional)
- Testcases:
- No testcase defined.
acs::db::oracle method map_function_name (public)
<instance of acs::db::oracle> map_function_name sql
Replace calls to function names in provided SQL (replace "package__object" by "package.object").
- Parameters:
- sql (required)
- Testcases:
- No testcase defined.
acs::db::oracle method sql_function_argument_list (protected)
<instance of acs::db::oracle> sql_function_argument_list \ sql_info
Build interface based on bind vars and named parameters Oracle
- Parameters:
- sql_info (required)
- Testcases:
- No testcase defined.
acs::db::oracle method sql_function_name (protected)
<instance of acs::db::oracle> sql_function_name package_name \ object_name
- Parameters:
- package_name (required)
- object_name (required)
- Testcases:
- No testcase defined.
acs::db::oracle method typemap (protected)
<instance of acs::db::oracle> typemap
- Testcases:
- No testcase defined.
acs::db::postgresql method argument_name_match (protected)
<instance of acs::db::postgresql> argument_name_match \ [ -key key ] [ -function_arg_names function_arg_names ] \ [ -db_names db_names ]
Does the name from function_args match the names obtained from PostgreSQL?
- Switches:
- -key (optional)
- -function_arg_names (optional)
- -db_names (optional)
- Testcases:
- No testcase defined.
acs::db::postgresql method db_proc_opt_arg_spec (protected)
<instance of acs::db::postgresql> db_proc_opt_arg_spec \ [ -name name ] [ -type type ] [ -default default ]
Handling of default values: - $optional eq "N", default ignored, the attribute is required - default value different from NULL --> make it default - otherwise: non-required argument, bindvars e.g. empty it to null
- Switches:
- -name (optional)
- -type (optional)
- -default (optional)
- Testcases:
- No testcase defined.
acs::db::postgresql method expected_result_types (protected)
<instance of acs::db::postgresql> expected_result_types
- Testcases:
- No testcase defined.
acs::db::postgresql method get_all_package_functions (public)
<instance of acs::db::postgresql> get_all_package_functions \ [ -dbn dbn ]
PostgreSQL version of obtaining information about the procedures and functions stored in the DB. For PostgreSQL, we keep this in the table "function_args". The information from "acs_function_args" defines, for which functions we want to create an interface. The information is completed with the definitions from the system catalog of PostgreSQL. The resulting list contains entries of the form: sqlpackage object {argument_names ... types ... defaulted ... defaults result_type ....} Currently, "defaults" are only available for PostgreSQL
- Switches:
- -dbn (optional)
- Testcases:
- No testcase defined.
acs::db::postgresql method map_function_name (public)
<instance of acs::db::postgresql> map_function_name sql
Replace calls to function names in provided SQL (dummy function for PostgreSQL)
- Parameters:
- sql (required)
- Testcases:
- No testcase defined.
acs::db::postgresql method psql_statement_suffix (protected)
<instance of acs::db::postgresql> psql_statement_suffix \ package_name object_name
- Parameters:
- package_name (required)
- object_name (required)
- Testcases:
- No testcase defined.
acs::db::postgresql method sql_function_argument_list (protected)
<instance of acs::db::postgresql> sql_function_argument_list \ sql_info
Build interface based on bind vars for PostgreSQL
- Parameters:
- sql_info (required)
- Testcases:
- No testcase defined.
acs::db::postgresql method sql_function_name (protected)
<instance of acs::db::postgresql> sql_function_name package_name \ object_name
- Parameters:
- package_name (required)
- object_name (required)
- Testcases:
- No testcase defined.
acs::db::postgresql method typemap (protected)
<instance of acs::db::postgresql> typemap
- Testcases:
- No testcase defined.