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[i], ::acs::db::nsdb-oracle[i], ::acs::db::SQL[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::nsdb-oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::SQL[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::nsdb-oracle[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::nsdb-oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::nsdb-oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::nsdb-oracle[i], ::acs::db::nsdbi-postgresql[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::postgresql[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::SQL[i], ::acs::db::oracle[i], ::acs::db::oracle[i], ::acs::db::SQL[i], ::acs::db::postgresql[i], ::acs::db::oracle[i]

Location:
packages/acs-tcl/tcl/acs-db-12-procs.tcl
Created:
2022-02-07
Author:
Gustaf Neumann

Procedures in this file

Detailed information

Class ::acs::db::SQL (public)

 ::nx::Class ::acs::db::SQL[i]

Generic superclass for all SQL dialects.

Testcases:
No testcase defined.

Class ::acs::db::nsdb-oracle (public)

 ::nx::Class ::acs::db::nsdb-oracle[i]

Oracle backend for nsdb driver

Testcases:
No testcase defined.

Class ::acs::db::nsdbi-postgresql (public)

 ::nx::Class ::acs::db::nsdbi-postgresql[i]

PostgreSQL backend for nsdbi driver

Testcases:
No testcase defined.

Class ::acs::db::oracle (public)

 ::nx::Class ::acs::db::oracle[i]

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[i]

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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> typemap

Testcases:
No testcase defined.

acs::db::postgresql method argument_name_match (protected)

 <instance of acs::db::postgresql[i]> 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[i]> 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[i]> expected_result_types

Testcases:
No testcase defined.

acs::db::postgresql method get_all_package_functions (public)

 <instance of acs::db::postgresql[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> typemap

Testcases:
No testcase defined.
[ show source ]