doc_adp_execute_file (public)

 doc_adp_execute_file [ -no_cache ] file_name

Defined in packages/acs-tcl/tcl/adp-parser-procs.tcl

Compiles and executes an ADP file. Caches the results of compilation unless -no_cache is specified.

Switches:
-no_cache
(boolean) (optional)
Parameters:
file_name

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) ad_file ad_file (public) doc_adp_compile doc_adp_compile (public) doc_adp_execute_file doc_adp_execute_file doc_adp_execute_file->_ doc_adp_execute_file->ad_file doc_adp_execute_file->doc_adp_compile

Testcases:
No testcase defined.
Source code:
    if { $no_cache_p } {
    # Not caching at all - just read and compile.

    set file [open $file_name "r"]
    set adp_code [read $file]
    close $file
    set tcl_code [doc_adp_compile $adp_code]
    } else {
    set reparse_p 0
    set mtime [ad_file mtime $file_name]
    set size [ad_file size $file_name]

    # See whether the file has been cached, i.e., the __doc_adp_cache_info,$file_name
    # proc has been declared. If it has, the proc will return a two-element list
    # consisting of the mtime/size of the file when it was cached, which we then compare
    # to the current mtime/size of the file. If they don't match, read in the file,
    # compile, and save the results in __doc_adp_cache,$file_name; if they do match,
    # then __doc_adp_cache,$file_name has already been defined.
    #
    # We use procs so that the Tcl code can be byte-code-compiled for extra performance
    # benefit.

    if { [catch { set info [__doc_adp_cache_info,$file_name] }]
         || [lindex $info 0] != $mtime
         || [lindex $info 1] != $size } {
        set reparse_p 1
    } else {
        ns_log "Error" "CACHE HIT for $file_name"
    }
    if { $reparse_p } {
        ns_log "Error" "parsing $file_name"
        set file [open $file_name "r"]
        set adp_code [read $file]
        close $file
        proc __doc_adp_cache,$file_name {} [doc_adp_compile $adp_code]
        proc __doc_adp_cache_info,$file_name {} "return { $mtime $size }"
    }
    set tcl_code "__doc_adp_cache,$file_name"
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: