apm_load_queries (private)

 apm_load_queries [ -packages packages ] [ -callback callback ] \
    [ -test_queries ]

Defined in packages/acs-tcl/tcl/apm-procs.tcl

Load up the queries for all enabled packages (or all specified packages). Follows the pattern of the load_libraries proc, but only loads query information

Switches:
-packages (optional)
Optional list of keys for packages to load queries for.
-callback (optional, defaults to "apm_dummy_callback")
-test_queries (optional, boolean)
Author:
ben@mit.edu

Partial Call Graph (max 5 caller/called nodes):
%3 apm_load_packages apm_load_packages (public) apm_load_queries apm_load_queries apm_load_packages->apm_load_queries apm_package_install apm_package_install (public) apm_package_install->apm_load_queries ad_find_all_files ad_find_all_files (public) apm_load_queries->ad_find_all_files apm_enabled_packages apm_enabled_packages (public) apm_load_queries->apm_enabled_packages apm_guess_db_type apm_guess_db_type (public) apm_load_queries->apm_guess_db_type apm_guess_file_type apm_guess_file_type (public) apm_load_queries->apm_guess_file_type db_qd_load_query_file db_qd_load_query_file (public) apm_load_queries->db_qd_load_query_file

Testcases:
No testcase defined.
Source code:
    if { $packages eq "" } {
        set packages [apm_enabled_packages]
    }

    # Scan the package directory for files to source.
    set files [list]
    foreach package $packages {

        set files [ad_find_all_files $::acs::rootdir/packages/$package]
        if { [llength $files] == 0 } {
            ns_log Error "apm_load_queries: Unable to locate $::acs::rootdir/packages/$package/*. when scanning for SQL queries to load."
        }

        set testdir    "$::acs::rootdir/packages/$package/tcl/test"
        set testlength [string length $testdir]

        foreach file [lsort $files] {

            set file_db_type [apm_guess_db_type $package $file]
            set file_type [apm_guess_file_type $package $file]

            if {![string compare -length $testlength $testdir $file]} {
                set is_test_file_p 1
            } else {
                set is_test_file_p 0
            }

            #
            # Note this exclusive or represents the following:
            # test_queries_p - Load normal xql files or load test xql files
            # is_test_file_p - Current file is a test file or not.
            #
            # !(test_queries_p ^ is_test_file_p)  = Load it or not?
            #             !( 0 ^ 0 )             = Yep
            #             !( 0 ^ 1 )             = Nope
            #             !( 1 ^ 0 )             = Nope
            #             !( 1 ^ 1 )             = Yep
            #
            if {!($test_queries_p ^ $is_test_file_p)
                && $file_type eq "query_file"
                && ($file_db_type eq "" || $file_db_type eq [db_type])
            } {
                db_qd_load_query_file $file
            }
        }
    }
    ns_log debug "apm_load_queries: DONE looping through files from which to load queries"
Generic XQL file:
packages/acs-tcl/tcl/apm-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: