db_list (public)
db_list [ -dbn dbn ] [ -cache_key cache_key ] \ [ -cache_pool cache_pool ] [ -subst subst ] statement_name sql \ [ -bind bind ]
Defined in packages/acs-tcl/tcl/01-database-procs.tcl
- Switches:
- -dbn (optional)
- The database name to use. If empty_string, uses the default database.
- -cache_key (optional)
- Cache the result using given value as the key. Default is to not cache.
- -cache_pool (optional, defaults to
"db_cache_pool"
)- Override the default db_cache_pool
- -subst (optional, defaults to
"all"
)- Perform Tcl substitution in xql-files. Possible values: all, none, vars, commands
- -bind (optional)
- bind variables, passed either as an ns_set id, or via bind value list
- Parameters:
- statement_name (required)
- name of the SQL query.
- sql (required)
- SQL query to be executed.
- Returns:
- a Tcl list of the values in the first column of the result of SQL query sql. If the SQL query doesn't return any rows, returns an empty list.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- db__caching, db__list_variants
Source code: # Query Dispatcher (OpenACS - SDW) set full_statement_name [db_qd_get_fullname $statement_name] # Can't use db_foreach in this proc, since we need to use the ns_set directly. set code { db_with_handle -dbn $dbn db { set selection [db_exec -subst $subst select $db $full_statement_name $sql] set result [list] while { [db_getrow $db $selection] } { lappend result [ns_set value $selection 0] } } return $result } if { [info exists cache_key] } { return [ns_cache eval $cache_pool $cache_key $code] } else { return [eval $code] }XQL Not present: Generic, PostgreSQL, Oracle