Index: openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 12 Apr 2001 16:58:18 -0000 1.1 +++ openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 16 Apr 2001 21:59:47 -0000 1.2 @@ -284,7 +284,7 @@ if {[string equal $file_type query_file] && ([empty_string_p $file_type] || [string equal $file_db_type $db_type])} { - db_fullquery_internal_load_cache $file + db_qd_load_query_file $file } } } Index: openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs-postgresql.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 13 Apr 2001 19:10:32 -0000 1.2 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 16 Apr 2001 21:59:47 -0000 1.3 @@ -28,7 +28,7 @@ # I'm not happy about having to get the fullname here, but right now # I can't figure out a cleaner way to do it. I will have to # revisit this ASAP. (ben) - set full_statement_name [db_fullquery_get_fullname $statement_name] + set full_statement_name [db_qd_get_fullname $statement_name] if { [info exists bind_output] } { return -code error "the -bind_output switch is not currently supported" @@ -37,7 +37,7 @@ db_with_handle db { # plsql calls that are simple selects bypass the plpgsql # mechanism for creating anonymous functions (OpenACS - Dan). - set test_sql [db_fullquery_replace_sql $full_statement_name $sql] + set test_sql [db_qd_replace_sql $full_statement_name $sql] if {[regexp -nocase -- {^\s*select} $test_sql match]} { ns_log Notice "PLPGSQL: bypassed anon function" set selection [db_exec 0or1row $db $full_statement_name $sql] @@ -72,7 +72,7 @@ ns_log Notice "PRE-QD: the SQL is $sql" # Query Dispatcher (OpenACS - ben) - set sql [db_fullquery_replace_sql $statement_name $sql] + set sql [db_qd_replace_sql $statement_name $sql] ns_log Notice "POST-QD: the SQL is $sql" @@ -199,7 +199,7 @@ ns_log Notice "PRE-QD: the SQL is $sql for $statement_name" # Query Dispatcher (OpenACS - ben) - set sql [db_fullquery_replace_sql $statement_name $sql] + set sql [db_qd_replace_sql $statement_name $sql] ns_log Notice "POST-QD: the SQL is $sql" @@ -237,7 +237,7 @@ ad_arg_parser { bind } $args # Query Dispatcher (OpenACS - ben) - set full_statement_name [db_fullquery_get_fullname $statement_name] + set full_statement_name [db_qd_get_fullname $statement_name] db_with_handle db { db_exec dml $db $full_statement_name $sql Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 12 Apr 2001 16:58:18 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 16 Apr 2001 21:59:47 -0000 1.2 @@ -184,7 +184,7 @@ } { # Query Dispatcher (OpenACS - ben) - set full_name [db_fullquery_get_fullname $statement_name] + set full_name [db_qd_get_fullname $statement_name] ad_arg_parser { default bind } $args @@ -259,7 +259,7 @@ } { # Query Dispatcher (OpenACS - ben) - set full_statement_name [db_fullquery_get_fullname $statement_name] + set full_statement_name [db_qd_get_fullname $statement_name] ad_arg_parser { bind column_array column_set args } $args @@ -463,7 +463,7 @@ ad_arg_parser { bind column_array column_set } $args # Query Dispatcher (OpenACS - ben) - set full_statement_name [db_fullquery_get_fullname $statement_name] + set full_statement_name [db_qd_get_fullname $statement_name] if { [info exists column_array] && [info exists column_set] } { return -code error "Can't specify both column_array and column_set" Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 12 Apr 2001 19:25:37 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 16 Apr 2001 21:59:47 -0000 1.8 @@ -772,7 +772,7 @@ set ul_p 1 } apm_callback_and_log $callback "
  • Loading query file $path/$query_file..." - db_fullquery_internal_load_cache $path/$query_file + db_qd_load_query_file $path/$query_file } if { $ul_p } { apm_callback_and_log $callback "\n" Index: openacs-4/packages/acs-tcl/tcl/db-query-dispatcher-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/db-query-dispatcher-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-tcl/tcl/db-query-dispatcher-procs.tcl 16 Apr 2001 04:46:21 -0000 1.5 +++ openacs-4/packages/acs-tcl/tcl/db-query-dispatcher-procs.tcl 16 Apr 2001 21:59:47 -0000 1.6 @@ -113,7 +113,7 @@ # For now, we're going to say that versions are numbers and that # there is always backwards compatibility. -proc db_fullquery_pick_most_specific_query {rdbms query_1 query_2} { +proc db_qd_pick_most_specific_query {rdbms query_1 query_2} { set rdbms_1 [db_fullquery_get_rdbms $query_1] set rdbms_2 [db_fullquery_get_rdbms $query_2] @@ -143,8 +143,14 @@ # ################################################ +# A procedure that is called from the outside world (APM) +# to load a particular file +proc db_qd_load_query_file {file_path} { + db_qd_internal_load_cache $file_path +} + # Find the fully qualified name of the query -proc db_fullquery_get_fullname {local_name {added_stack_num 1}} { +proc db_qd_get_fullname {local_name {added_stack_num 1}} { # We do a check to see if we already have a fullname. # Since the DB procs are a bit incestuous, this might get # called more than once. DAMMIT! (ben) @@ -244,15 +250,15 @@ # This procedure returns the latest FullQuery data structure # given proper scoping rules for a complete/global query name. # This may or may not be cached, the caller need not know. -proc db_fullquery_fetch {fullquery_name {rdbms {}}} { +proc db_qd_fetch {fullquery_name {rdbms {}}} { # For now we consider that everything is cached # from startup time - return [db_fullquery_internal_get_cache $fullquery_name] + return [db_qd_internal_get_cache $fullquery_name] } # Do the right thing -proc db_fullquery_replace_sql {statement_name sql} { - set fullquery [db_fullquery_fetch $statement_name] +proc db_qd_replace_sql {statement_name sql} { + set fullquery [db_qd_fetch $statement_name] if {![empty_string_p $fullquery]} { set sql [db_fullquery_get_querytext $fullquery] @@ -289,7 +295,7 @@ # # The file_tag parameter is for later flushing of a series # of queries when a particular query file has been changed. -proc db_fullquery_internal_load_queries {file_pointer file_tag} { +proc db_qd_internal_load_queries {file_pointer file_tag} { # While there are surely efficient ways of loading large files, # we're going to assume smaller files for now. Plus, this doesn't happen # often. @@ -300,18 +306,18 @@ set whole_file [read $file_pointer] # Iterate and parse out each query - set parsing_state [db_fullquery_internal_parse_init $whole_file] + set parsing_state [db_qd_internal_parse_init $whole_file] ns_log Notice "QD = parsing state - $parsing_state" # We need this for queries with relative paths set acs_file_path [ad_make_relative_path $file_tag] - set queryname_root [db_fullquery_internal_get_queryname_root $acs_file_path] + set queryname_root [db_qd_internal_get_queryname_root $acs_file_path] ns_log Notice "QD = queryname root is $queryname_root" while {1} { - set result [db_fullquery_internal_parse_one_query $parsing_state] + set result [db_qd_internal_parse_one_query $parsing_state] ns_log Notice "QD = one parse result -$result-" @@ -343,13 +349,13 @@ } # Store the query - db_fullquery_internal_store_cache $one_query + db_qd_internal_store_cache $one_query } } # Load from Cache -proc db_fullquery_internal_get_cache {fullquery_name} { +proc db_qd_internal_get_cache {fullquery_name} { # If we have no record if {![nsv_exists OACS_FULLQUERIES $fullquery_name]} { @@ -371,7 +377,7 @@ # Store in Cache # # The load_location is the file where this query was found -proc db_fullquery_internal_store_cache {fullquery} { +proc db_qd_internal_store_cache {fullquery} { # Check if it's compatible at all! if {![db_rdbms_compatible_p [db_fullquery_get_rdbms $fullquery] [db_current_rdbms]]} { @@ -388,23 +394,23 @@ if {[nsv_exists OACS_FULLQUERIES $name]} { set old_fullquery [nsv_get OACS_FULLQUERIES $name] - set fullquery [db_fullquery_pick_most_specific_query [db_current_rdbms] $old_fullquery $fullquery] + set fullquery [db_qd_pick_most_specific_query [db_current_rdbms] $old_fullquery $fullquery] } nsv_set OACS_FULLQUERIES $name $fullquery } # Flush queries for a particular file path, and reload them -proc db_fullquery_internal_load_cache {file_path} { +proc db_qd_internal_load_cache {file_path} { # First we actually need to flush queries that are associated with that file tag # in case they are not all replaced by reloading that file. That is nasty! Oh well. # We'll do this later # we just reparse the file set stream [open $file_path "r"] - db_fullquery_internal_load_queries $stream $file_path + db_qd_internal_load_queries $stream $file_path close $stream } @@ -413,7 +419,7 @@ ## NAMING ## -proc db_fullquery_internal_get_queryname_root {relative_path} { +proc db_qd_internal_get_queryname_root {relative_path} { # remove the prepended "/packages/" string regsub {^\/?packages\/} $relative_path {} relative_path @@ -438,7 +444,7 @@ ## in the future. But right now we keep things simple # Initialize the parsing state -proc db_fullquery_internal_parse_init {stuff_to_parse} { +proc db_qd_internal_parse_init {stuff_to_parse} { # Do initial parse set parsed_doc [ns_xml parse -persist $stuff_to_parse] @@ -470,7 +476,7 @@ } # Parse one query using the query state -proc db_fullquery_internal_parse_one_query {parsing_state} { +proc db_qd_internal_parse_one_query {parsing_state} { # Find the index that we're looking at set index [lindex $parsing_state 0] @@ -510,7 +516,7 @@ set parsing_state [list $index $node_list [lindex $parsing_state 2] $default_rdbms] # Parse the actual query from XML - set one_query [db_fullquery_internal_parse_one_query_from_xml_node $one_query_xml $default_rdbms] + set one_query [db_qd_internal_parse_one_query_from_xml_node $one_query_xml $default_rdbms] # Return the query and the parsing state return [list $one_query $parsing_state] @@ -519,7 +525,7 @@ # Parse one query from an XML node -proc db_fullquery_internal_parse_one_query_from_xml_node {one_query_node {default_rdbms {}}} { +proc db_qd_internal_parse_one_query_from_xml_node {one_query_node {default_rdbms {}}} { ns_log Notice "QD = parsing one query node in XML with name -[ns_xml node name $one_query_node]-" # Check that this is a fullquery