%3 ::nx::Object ::nx::Object ::acs::db::SQL ::acs::db::SQL build_function_argument_list build_stub_body create_db_function_interface dbfunction_argument_value dbfunction_to_tcl dbproc_arg ::acs::db::SQL->::nx::Object ::acs::db::oracle ::acs::db::oracle db_proc_opt_arg_spec expected_result_types get_all_package_functions map_function_name sql_function_argument_list sql_function_name typemap ::acs::db::oracle->::acs::db::SQL ::acs::db::postgresql ::acs::db::postgresql argument_name_match db_proc_opt_arg_spec expected_result_types get_all_package_functions map_function_name psql_statement_suffix sql_function_argument_list sql_function_name typemap ::acs::db::postgresql->::acs::db::SQL ::acs::db::nsdb-oracle ::acs::db::nsdb-oracle build_psql_body ::acs::db::nsdb-oracle->::acs::db::oracle ::acs::db::nsdb ::acs::db::nsdb ::acs::db::nsdb-oracle->::acs::db::nsdb ::acs::db::nsdb-postgresql ::acs::db::nsdb-postgresql build_psql_body call acs add_user call acs magic_object_id call acs remove_user call acs_activity delete call acs_activity edit call acs_activity name call acs_activity new call acs_activity object_map call acs_activity object_unmap call acs_attribute add_description call acs_attribute create_attribute call acs_attribute drop_attribute call acs_attribute drop_description call acs_datatype date_output_function call acs_datatype timestamp_output_function call acs_event activity_set call acs_event delete call acs_event delete_all call acs_event delete_all_recurrences call acs_event get_description call acs_event get_html_p call acs_event get_name call acs_event get_status_summary call acs_event get_value call acs_event insert_instances call acs_event instances_exist_p call acs_event new call acs_event new_instance call acs_event party_map call acs_event party_unmap call acs_event recurrence_timespan_edit call acs_event recurs_p call acs_event shift call acs_event shift_all call acs_event timespan_set call acs_group check_representation call acs_group delete call acs_group member_p call acs_group name call acs_group new call acs_log debug call acs_log error call acs_log notice call acs_log warn call acs_message delete call acs_message delete_extlink call acs_message delete_file call acs_message delete_image call acs_message edit call acs_message edit_extlink call acs_message edit_file call acs_message edit_image call acs_message first_ancestor call acs_message message_p call acs_message name call acs_message new call acs_message new_file call acs_message new_image call acs_message send call acs_message_get_tree_sortkey call acs_object check_object_ancestors call acs_object check_object_descendants call acs_object check_path call acs_object default_name call acs_object delete call acs_object get_attr_storage_column call acs_object get_attr_storage_sql call acs_object get_attr_storage_table call acs_object get_attribute call acs_object get_attribute_storage call acs_object initialize_attributes call acs_object name call acs_object new call acs_object package_id call acs_object set_attribute call acs_object update_last_modified call acs_object_type create_type call acs_object_type drop_type call acs_object_type is_subtype_p call acs_object_type pretty_name call acs_object_type_get_tree_sortkey call acs_object_util get_object_type call acs_object_util object_ancestor_type_p call acs_object_util object_type_exist_p call acs_object_util object_type_p call acs_object_util type_ancestor_type_p call acs_permission grant_permission call acs_permission permission_p call acs_permission permission_p_recursive_array call acs_permission revoke_permission call acs_privilege add_child call acs_privilege create_privilege call acs_privilege drop_privilege call acs_privilege remove_child call acs_reference delete call acs_reference is_expired_p call acs_reference new call acs_rel delete call acs_rel new call acs_rel_type create_role call acs_rel_type create_type call acs_rel_type drop_role call acs_rel_type drop_type call acs_rel_type role_pretty_name call acs_rel_type role_pretty_plural call acs_sc_binding delete call acs_sc_binding exists_p call acs_sc_binding new call acs_sc_contract delete call acs_sc_contract get_id call acs_sc_contract get_name call acs_sc_contract new call acs_sc_impl delete call acs_sc_impl get_id call acs_sc_impl get_name call acs_sc_impl new call acs_sc_impl_alias delete call acs_sc_impl_alias new call acs_sc_msg_type delete call acs_sc_msg_type get_id call acs_sc_msg_type get_name call acs_sc_msg_type new call acs_sc_msg_type new_element call acs_sc_msg_type parse_spec call acs_sc_operation get_id call acs_sc_operation new call acs_user approve_email call acs_user delete call acs_user new call acs_user unapprove_email call admin_rel delete call admin_rel new call apm get_value call apm id_for_name call apm parameter_p call apm register_application call apm register_p call apm register_package call apm register_parameter call apm register_service call apm set_global_value call apm set_value call apm unregister_application call apm unregister_package call apm unregister_parameter call apm unregister_service call apm update_package call apm update_parameter call apm_application delete call apm_application new call apm_package delete call apm_package highest_version call apm_package initial_install_p call apm_package initialize_parameters call apm_package is_child call apm_package name call apm_package new call apm_package num_instances call apm_package parent_id call apm_package singleton_p call apm_package_type create_type call apm_package_type drop_type call apm_package_type num_parameters call apm_package_type update_type call apm_package_version add_dependency call apm_package_version add_interface call apm_package_version copy call apm_package_version delete call apm_package_version disable call apm_package_version edit call apm_package_version enable call apm_package_version new call apm_package_version remove_dependency call apm_package_version remove_interface call apm_package_version sortable_version_name call apm_package_version upgrade call apm_package_version upgrade_p call apm_package_version version_name_greater call apm_parameter_value delete call apm_parameter_value new call apm_service delete call apm_service new call application_group new call authority del call authority new call cal_item delete call cal_item new call cal_uid upsert call calendar delete call calendar new call category change_parent call category del call category edit call category name call category new call category new_translation call category phase_in call category phase_out call category_link del call category_link new call category_synonym convert_string call category_synonym del call category_synonym edit call category_synonym get_similarity call category_synonym new call category_synonym reindex call category_synonym search call category_tree check_nested_ind call category_tree copy call category_tree del call category_tree edit call category_tree map call category_tree name call category_tree new call category_tree new_translation call category_tree unmap call cmp_pg_version call column_exists call composition_rel check_index call composition_rel check_path_exists_p call composition_rel check_representation call composition_rel delete call composition_rel new call content_extlink copy call content_extlink delete call content_extlink is_extlink call content_extlink new call content_folder copy call content_folder del call content_folder delete call content_folder edit_name call content_folder get_index_page call content_folder get_label call content_folder is_empty call content_folder is_folder call content_folder is_registered call content_folder is_root call content_folder is_sub_folder call content_folder move call content_folder new call content_folder register_content_type call content_folder unregister_content_type call content_item copy call content_item copy2 call content_item del call content_item delete call content_item edit_name call content_item generic_move call content_item get_best_revision call content_item get_content_type call content_item get_context call content_item get_id call content_item get_latest_revision call content_item get_live_revision call content_item get_parent_folder call content_item get_path call content_item get_publish_date call content_item get_revision_count call content_item get_root_folder call content_item get_template call content_item get_title call content_item get_virtual_path call content_item is_index_page call content_item is_publishable call content_item is_published call content_item is_subclass call content_item is_valid_child call content_item move call content_item new call content_item register_template call content_item relate call content_item set_live_revision call content_item set_release_period call content_item unregister_template call content_item unrelate call content_item unset_live_revision call content_item write_to_file call content_keyword del call content_keyword delete call content_keyword get_description call content_keyword get_heading call content_keyword get_path call content_keyword is_assigned call content_keyword is_leaf call content_keyword item_assign call content_keyword item_unassign call content_keyword new call content_keyword set_description call content_keyword set_heading call content_revision content_copy call content_revision copy call content_revision copy_attributes call content_revision del call content_revision delete call content_revision get_content call content_revision get_number call content_revision is_latest call content_revision is_live call content_revision new call content_revision revision_name call content_revision to_html call content_revision to_temporary_clob call content_symlink del call content_symlink delete call content_symlink is_symlink call content_symlink resolve call content_symlink resolve_content_type call content_template del call content_template delete call content_template get_path call content_template is_template call content_template new call content_type create_attribute call content_type create_type call content_type drop_attribute call content_type drop_type call content_type get_template call content_type is_content_type call content_type refresh_trigger call content_type refresh_view call content_type register_child_type call content_type register_mime_type call content_type register_relation_type call content_type register_template call content_type rotate_template call content_type set_default_template call content_type trigger_insert_statement call content_type unregister_child_type call content_type unregister_mime_type call content_type unregister_relation_type call content_type unregister_template call cr_items_get_tree_sortkey call cr_keywords_get_tree_sortkey call define_function_args call doc get_package_header call doc get_proc_header call drop_package call etp create_extlink call etp create_new_revision call etp create_page call etp create_symlink call etp get_attribute_value call etp get_description call etp get_folder_id call etp get_relative_url call etp get_title call faq new_q_and_a call file_storage copy_file call file_storage delete_file call file_storage delete_folder call file_storage delete_version call file_storage get_content_type call file_storage get_folder_name call file_storage get_package_id call file_storage get_parent_id call file_storage get_root_folder call file_storage get_title call file_storage move_file call file_storage new_file call file_storage new_folder call file_storage new_root_folder call file_storage new_version call file_storage rename_file call forums_forum delete call forums_forum name call forums_forum new call forums_message delete call forums_message delete_thread call forums_message name call forums_message new call forums_message root_message_id call forums_message set_state call forums_message thread_close call forums_message thread_open call forums_reading_info move_thread_update call forums_reading_info remove_msg call forums_reading_info user_add_forum call forums_reading_info user_add_msg call fs_simple_object delete call fs_simple_object new call fs_url delete call fs_url new call get_func_definition call get_func_drop_command call get_func_header call group_contains_p call image delete call image new call image new_revision call instr call int_to_tree_key call journal_entry delete call journal_entry delete_for_object call journal_entry new call lob_copy call lob_get_data call lob_length call membership_rel approve call membership_rel ban call membership_rel check_index call membership_rel check_representation call membership_rel delete call membership_rel deleted call membership_rel expire call membership_rel merge call membership_rel new call membership_rel reject call membership_rel unapprove call news archive call news clone call news delete call news make_permanent call news name call news new call news revision_delete call news revision_new call news revision_set_active call news set_approve call news status call notification delete call notification new call notification_delivery_method delete call notification_delivery_method new call notification_interval delete call notification_interval new call notification_reply delete call notification_reply new call notification_request delete call notification_request delete_all call notification_request delete_all_for_user call notification_request new call notification_type delete call notification_type new call number_src call party delete call party email call party name call party new call party_approved_member add call party_approved_member add_one call party_approved_member remove call party_approved_member remove_one call person delete call person first_names call person last_name call person name call person new call rdbms_date call recurrence delete call recurrence new call rel_constraint delete call rel_constraint get_constraint_id call rel_constraint new call rel_constraint violation call rel_constraint violation_if_removed call rel_segment delete call rel_segment get call rel_segment get_or_new call rel_segment name call rel_segment new call rss_gen_subscr del call rss_gen_subscr new call rule_exists call search_observer dequeue call search_observer enqueue call sec_session_property upsert call site_node delete call site_node find_pattern call site_node new call site_node node_id call site_node url call site_node_object_map del call site_node_object_map new call split call subsite_callback new call table_exists call template_demo_note del call template_demo_note new call time_interval copy call time_interval delete call time_interval edit call time_interval eq call time_interval new call time_interval overlaps_p call time_interval shift call timespan copy call timespan delete call timespan exists_p call timespan interval_delete call timespan join call timespan join_interval call timespan multi_interval_p call timespan new call timespan overlaps_interval_p call timespan overlaps_p call timezone add_rule call timezone convert_to_local call timezone convert_to_utc call timezone delete call timezone get_abbrev call timezone get_date call timezone get_id call timezone get_offset call timezone get_rawoffset call timezone isdst_p call timezone new call tree_ancestor_key call tree_ancestor_p call tree_increment_key call tree_key_to_int call tree_leaf_key_to_int call tree_left call tree_level call tree_next_key call tree_right call tree_root_key call trigger_exists call trigger_func_exists call trigger_type call user_profile new call util foreign_key_exists call util get_default call util get_primary_keys call util index_exists call util logical_negation call util multiple_nextval call util not_null_exists call util primary_key_exists call util table_column_exists call util table_exists call util unique_exists call util view_exists call views record_view call views_by_type record_view call workflow_case_log_entry new ::acs::db::nsdb-postgresql->::acs::db::postgresql ::acs::db::nsdb-postgresql->::acs::db::nsdb ::acs::db::nsdbi-postgresql ::acs::db::nsdbi-postgresql build_psql_body ::acs::db::nsdbi-postgresql->::acs::db::postgresql ::acs::db::nsdbi ::acs::db::nsdbi ::acs::db::nsdbi-postgresql->::acs::db::nsdbi

Class ::acs::db::SQL

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

Generic superclass for all SQL dialects.
Defined in packages/acs-tcl/tcl/acs-db-12-procs.tcl

Class Relations

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

Methods (to be applied on instances)

  • create_db_function_interface (scripted, 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.
    ns_log notice "Creating DB function interface"  "(driver '[::acs::dc cget -driver]', backend '[::acs::dc cget -backend]')"
    
    set db_definitions ""
    foreach item [:get_all_package_functions -dbn $dbn] {
        lassign $item package_name object_name sql_info
        #ns_log notice "get_all_package_functions returns ($package_name $object_name)"
    
        if {[string match "*TRG" [string toupper $object_name]]} {
            # no need to provide interface to trigger functions
            continue
        }
    
        set package_name [string tolower $package_name]
        set object_name [string tolower $object_name]
        set key ${package_name}.${object_name}
        if {$match ne "*" && ![string match $match $key]} {
            continue
        }
    
        set nr_args [llength [dict get $sql_info argument_names]]
        if {
            [llength [dict get $sql_info types]] != $nr_args
            || [llength [dict get $sql_info defaulted]] != $nr_args
            || [llength [dict get $sql_info defaults]] != $nr_args
        } {
            ns_log warning "Inconsistent definition skipped: $key"  "argument_names $nr_args"  "types [llength [dict get $sql_info types]]"  "defaulted [llength [dict get $sql_info defaulted]]"  "defaults [llength [dict get $sql_info defaults]]\n"  "names     [dict get $sql_info argument_names]\n"  "types     [dict get $sql_info types]\n"  "defaulted [dict get $sql_info defaulted]\n"  "defaults  [dict get $sql_info defaults]"
            continue
        }
    
        ns_log notice "generate stub for '$key'"
        if {![dict exists $db_definitions $key]} {
            dict set db_definitions $key package_name $package_name
            dict set db_definitions $key object_name $object_name
            dict set db_definitions $key sql_info $sql_info
        } else {
            #
            # We have multiple definitions. Take the definition
            # with the longest argument list.
            #
            set old_sql_info [dict get $db_definitions $key sql_info]
            if {[llength [dict get $old_sql_info argument_names] <
                 [llength dict get $sql_info argument_names]]} {
                dict set db_definitions $key sql_info $sql_info
            }
        }
    }
    foreach {key v} $db_definitions {
        dict with v {
            :dbfunction_to_tcl -verbose=$verbose  $package_name $object_name $sql_info
        }
    }