xo::db::require proc function_args (public)
xo::db::requirefunction_args [ -kernel_older_than kernel_older_than ] \ [ -package_key_and_version_older_than package_key_and_version_older_than ] \ [ -check_function check_function ] sql_file
Defined in /var/www/openacs.org/packages/xotcl-core/tcl/05-db-procs.tcl
Load the SQL file, if the kernel is older than the specified version, and the version of the specified package is older, and the check_function does not exist in function_args.
Sample usage: ::xo::db::require function_args \
-kernel_older_than 5.5.0 \
-older_than_package_key_and_version "xowiki 0.50" \
-check_function "acs_object_type__create_type" \
[acs_package_root_dir xotcl-request-broker]/patches/funcs-1.sql
- Switches:
- -kernel_older_than (optional)
- -package_key_and_version_older_than (optional)
- -check_function (optional)
- Parameters:
- sql_file (required)
- Testcases:
- No testcase defined.
Source code: if {[db_driverkey ""] eq "postgresql"} { # only necessary with PostgreSQL if {[info exists kernel_older_than]} { if {[apm_version_names_compare $kernel_older_than [ad_acs_version]] < 1} { # nothing to do return } } if {[info exists package_key_and_version_older_than]} { set p [split $package_key_and_version_older_than] if {[llength $p] != 2} { error "package_key_and_version_older_than should be of the form 'package_key version'" } lassign $p package_key version set installed_version [apm_highest_version_name $package_key] if {[apm_version_names_compare $installed_version $version] > -1} { # nothing to do return } } if {[info exists check_function]} { set check_function [string toupper $check_function] set function_exists [::xo::dc 0or1row function_exists { select 1 from dual where exists (SELECT 1 FROM acs_function_args WHERE function = :check_function) }] if {$function_exists} { # nothing to do return } } if {[ad_file readable $sql_file]} { :log "Sourcing '$sql_file'" db_source_sql_file $sql_file ::xo::db::Class create_all_functions return 1 } else { :log "Could not source '$sql_file'" } } return 0XQL Not present: Generic, PostgreSQL, Oracle