- Publicity: Public Only All
40-db-query-dispatcher-procs.tcl
Query Dispatching for multi-RDBMS capability
- Location:
- packages/acs-bootstrap-installer/tcl/40-db-query-dispatcher-procs.tcl
- Authors:
- Ben Adida <ben@openforce.net>
- Bart Teeuwisse <bart.teeuwisse@thecodemill.biz>
- CVS Identification:
$Id: 40-db-query-dispatcher-procs.tcl,v 1.51 2024/09/11 06:15:47 gustafn Exp $
Procedures in this file
- db_current_rdbms (public)
- db_fullquery_compatible_p (private)
- db_fullquery_create (private)
- db_fullquery_get_bind_vars (private)
- db_fullquery_get_load_location (private)
- db_fullquery_get_name (private)
- db_fullquery_get_query_type (private)
- db_fullquery_get_querytext (public)
- db_fullquery_get_rdbms (private)
- db_map (public)
- db_qd_fetch (public)
- db_qd_get_fullname (public)
- db_qd_internal_get_cache (private)
- db_qd_internal_get_queryname_root (private)
- db_qd_internal_load_cache (private)
- db_qd_internal_load_queries (private)
- db_qd_internal_parse_init (private)
- db_qd_internal_parse_one_query (private)
- db_qd_internal_parse_one_query_from_xml_node (private)
- db_qd_internal_store_cache (private)
- db_qd_load_query_file (public)
- db_qd_log (private)
- db_qd_make_absolute_path (private)
- db_qd_null_path (private)
- db_qd_pick_most_specific_query (private)
- db_qd_prepare_queryfile_content (public)
- db_qd_relative_path_p (private)
- db_qd_replace_sql (public)
- db_qd_root_path (private)
- db_rdbms_compatible_p (private)
- db_rdbms_create (public, deprecated)
- db_rdbms_get_type (private)
- db_rdbms_get_version (private)
- db_rdbms_parse_from_xml_node (private)
Detailed information
db_current_rdbms (public)
db_current_rdbms
- Returns:
- the current rdbms type and version.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__database_interface
db_fullquery_compatible_p (private)
db_fullquery_compatible_p fullquery [ rdbms ]
Check compatibility of a FullQuery against an RDBMS This procedure returns true or false. The RDBMS argument can be left out, in which case, the currently running RDBMS is the one against which compatibility will be checked. NOTE: not complete -- should return something depending on compatibility of RDBMSs
- Parameters:
- fullquery (required)
- rdbms (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_fullquery_create (private)
db_fullquery_create queryname querytext bind_vars_lst query_type rdbms \ load_location
FullQuery Data Abstraction Constructor
- Parameters:
- queryname (required)
- querytext (required)
- bind_vars_lst (required)
- query_type (required)
- rdbms (required)
- load_location (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_fullquery_get_bind_vars (private)
db_fullquery_get_bind_vars fullquery
Accessor for fullquery data abstraction
- Parameters:
- fullquery (required)
- datastructure constructed by db_fullquery_create
- Returns:
- bind vars
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_fullquery_get_load_location (private)
db_fullquery_get_load_location fullquery
Accessor for fullquery data abstraction
- Parameters:
- fullquery (required)
- datastructure constructed by db_fullquery_create
- Returns:
- load location
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_fullquery_get_name (private)
db_fullquery_get_name fullquery
Accessor for fullquery data abstraction
- Parameters:
- fullquery (required)
- datastructure constructed by db_fullquery_create
- Returns:
- name
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__database_interface
db_fullquery_get_query_type (private)
db_fullquery_get_query_type fullquery
Accessor for fullquery data abstraction
- Parameters:
- fullquery (required)
- datastructure constructed by db_fullquery_create
- Returns:
- query type
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__database_interface
db_fullquery_get_querytext (public)
db_fullquery_get_querytext fullquery
Accessor for fullquery data abstraction
- Parameters:
- fullquery (required)
- datastructure constructed by db_fullquery_create
- Returns:
- query text
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__database_interface
db_fullquery_get_rdbms (private)
db_fullquery_get_rdbms fullquery
Accessor for fullquery data abstraction
- Parameters:
- fullquery (required)
- datastructure constructed by db_fullquery_create
- Returns:
- rdbms descriptor
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_map (public)
db_map snippet_name
fetch a query snippet. used to provide db-specific query snippets when porting highly dynamic queries. (OpenACS - DanW)
- Parameters:
- snippet_name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db_map
db_qd_fetch (public)
db_qd_fetch fullquery_name [ rdbms ]
Fetch a query with a given name 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.
- Parameters:
- fullquery_name (required)
- rdbms (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__database_interface
db_qd_get_fullname (public)
db_qd_get_fullname local_name [ added_stack_num ]
Find the fully qualified name of the query
- Parameters:
- local_name (required)
- added_stack_num (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__database_interface
db_qd_internal_get_cache (private)
db_qd_internal_get_cache fullquery_name
Load from Cache
- Parameters:
- fullquery_name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_get_queryname_root (private)
db_qd_internal_get_queryname_root relative_path
- Parameters:
- relative_path (required)
- Returns:
- relative path with trailing .
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_load_cache (private)
db_qd_internal_load_cache file_path
Flush queries for a particular file path, and reload them
- Parameters:
- file_path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_load_queries (private)
db_qd_internal_load_queries file_pointer file_tag
Load up a bunch of queries from a file pointer The file_tag parameter is for later flushing of a series of queries when a particular query file has been changed. DRB: it is now used to track the mtime of the query file when loaded, used by the APM to determine when a package should be reloaded. This code depends on the file tag parameter being set to the actual file path to the query file.
- Parameters:
- file_pointer (required)
- file_tag (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_parse_init (private)
db_qd_internal_parse_init stuff_to_parse file_path
Initialize the parsing state
- Parameters:
- stuff_to_parse (required)
- file_path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_parse_one_query (private)
db_qd_internal_parse_one_query parsing_state
Parse one query using the query state
- Parameters:
- parsing_state (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_parse_one_query_from_xml_node (private)
db_qd_internal_parse_one_query_from_xml_node one_query_node \ [ default_rdbms ] [ file_path ]
Parse one query from an XML node
- Parameters:
- one_query_node (required)
- default_rdbms (optional)
- file_path (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_internal_store_cache (private)
db_qd_internal_store_cache fullquery
Store in Cache. The load_location is the file where this query was found.
- Parameters:
- fullquery (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_load_query_file (public)
db_qd_load_query_file file_path [ errorVarName ]
A procedure that is called from the outside world (APM) to load a particular file
- Parameters:
- file_path (required)
- errorVarName (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db_map
db_qd_log (private)
db_qd_log level [ args... ]
Centralized DB QD logging If you want to debug the QD, change QDDebug below to Debug
- Parameters:
- level (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_make_absolute_path (private)
db_qd_make_absolute_path relative_root suffix
Make a path absolute
- Parameters:
- relative_root (required)
- suffix (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_null_path (private)
db_qd_null_path
The null path
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_pick_most_specific_query (private)
db_qd_pick_most_specific_query rdbms query_1 query_2
For now, we're going to say that versions are numbers and that there is always backwards compatibility.
- Parameters:
- rdbms (required)
- query_1 (required)
- query_2 (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_prepare_queryfile_content (public)
db_qd_prepare_queryfile_content file_content
Prepare raw .xql-file content form xml-parsing via quoting. The result is parsable XML, where "partialquery" is replaced by "fullquery".
- Parameters:
- file_content (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- files__check_xql_files
db_qd_relative_path_p (private)
db_qd_relative_path_p path
Check if the path is relative
- Parameters:
- path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_qd_replace_sql (public)
db_qd_replace_sql [ -ulevel ulevel ] [ -subst subst ] statement_name \ sql
- Switches:
- -ulevel (optional)
- -subst (optional, defaults to
"all"
)- Parameters:
- statement_name (required)
- sql (required)
- Returns:
- sql for statement_name (defaulting to sql if not found)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__db_foreach, db_bind_var_substitution, db__transaction, db__transaction_bug_3440
db_qd_root_path (private)
db_qd_root_path
The token that indicates the root of all queries
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_rdbms_compatible_p (private)
db_rdbms_compatible_p rdbms_test rdbms_pattern
- Parameters:
- rdbms_test (required)
- rdbms_pattern (required)
- Returns:
- 0 if test incompatible with pattern, 1 if miscible
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_rdbms_create (public, deprecated)
db_rdbms_create type version
Deprecated. Invoking this procedure generates a warning.
The function is not needed, since all it returns is a plain Tcl dict with obvious keys (type and version)
- Parameters:
- type (required)
- version (required)
- Returns:
- rdbms descriptor in form of a dict
- See Also:
- dict
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_rdbms_get_type (private)
db_rdbms_get_type rdbms
Convenience function, could be replaced there with standard Tcl dict operations.
- Parameters:
- rdbms (required)
- descriptor in form of a type version pair
- Returns:
- rdbms name
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_rdbms_get_version (private)
db_rdbms_get_version rdbms
Convenience function, could be replaced there with standard Tcl dict operations.
- Parameters:
- rdbms (required)
- descriptor constructed by db_rdbms_create
- Returns:
- version identifier
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
db_rdbms_parse_from_xml_node (private)
db_rdbms_parse_from_xml_node rdbms_node
Parse an RDBMS struct from an XML fragment node
- Parameters:
- rdbms_node (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.