Class ::acs::db::oracle

::acs::db::oracle[i] create ...

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.
Defined in packages/acs-tcl/tcl/acs-db-12-procs.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::acs::db::SQL[i]
  • subclass: ::acs::db::nsdb-oracle[i]
::nx::Class create ::acs::db::oracle \
     -superclass ::acs::db::SQL

Methods (to be applied on instances)

  • get_all_package_functions (scripted, 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.
    set last_func ""
    set result {}
    set d {argument_names "" types "" defaulted "" defaults "" result_type ""}
    foreach tuple [:list_of_lists -dbn $dbn dbqd..[current method] {
        select package_name, object_name, position, argument_name, data_type, defaulted
        from all_arguments
        where package_name is not null
        and owner = USER
        order by package_name, object_name, position
    }] {
        lassign $tuple package_name object_name position argument_name data_type defaulted
        set func $package_name.$object_name
        if {$func ne $last_func && $last_func ne ""} {
            lappend result [list [dict get $d package_name] [dict get $d object_name] $d]
            set last_func $func
            set d {argument_names "" types "" defaulted "" defaults "" result_type ""}
        }
        #ns_log notice "$func ($last_func): $position $argument_name $data_type"
        dict set d package_name $package_name
        dict set d object_name $object_name
        set last_func $func
        if {$position == 0} {
            dict set d result_type $data_type
        } else {
            dict lappend d types $data_type
            dict lappend d argument_names $argument_name
            dict lappend d defaulted $defaulted
            dict lappend d defaults [expr {$defaulted eq "Y" ? "null" : ""} ]
        }
    }
    if {$last_func ne ""} {
        lappend result [list [dict get $d package_name] [dict get $d object_name] $d]
    }
    return $result
  • map_function_name (scripted, 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.
    return [string map [list "__" .] $sql]