apm_package_install_data_model (private)

 apm_package_install_data_model [ -callback callback ] \
    [ -upgrade_from_version_name upgrade_from_version_name ] \
    [ -data_model_files data_model_files ] [ -path path ] spec_file

Defined in packages/acs-tcl/tcl/apm-install-procs.tcl

Given a spec file, reads in the data model files to load from it.

Switches:
-callback (optional, defaults to "apm_dummy_callback")
-upgrade_from_version_name (optional)
-data_model_files (optional, defaults to "0")
-path (optional)
Parameters:
spec_file (required)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_package_install apm_package_install (public) apm_package_install_data_model apm_package_install_data_model apm_package_install->apm_package_install_data_model acs_package_root_dir acs_package_root_dir (public) apm_package_install_data_model->acs_package_root_dir apm_callback_and_log apm_callback_and_log (public) apm_package_install_data_model->apm_callback_and_log apm_data_model_scripts_find apm_data_model_scripts_find (public) apm_package_install_data_model->apm_data_model_scripts_find apm_read_package_info_file apm_read_package_info_file (public) apm_package_install_data_model->apm_read_package_info_file db_bounce_pools db_bounce_pools (public) apm_package_install_data_model->db_bounce_pools

Testcases:
No testcase defined.
Source code:
    array set version [apm_read_package_info_file $spec_file]
    set package_key $version(package.key)
    set upgrade_to_version_name $version(name)

    if { $path eq "" } {
        set path "[acs_package_root_dir $package_key]"
    }
    set ul_p 0

    if {($data_model_files == 0)} {
        set data_model_files [apm_data_model_scripts_find  -upgrade_from_version_name $upgrade_from_version_name  -upgrade_to_version_name $upgrade_to_version_name  -package_path $path  $package_key]
    }

    if { $data_model_files ne "" } {
        apm_callback_and_log $callback "<p><li>Installing data model for $version(package-name) $version(name)...\n"
    }

    foreach item $data_model_files {
        lassign $item file_path file_type

        ns_log Debug "apm_package_install_data_model: Now processing $file_path of type $file_type"
        if {$file_type eq "data_model_create" ||
            $file_type eq "data_model_upgrade" } {
            if { !$ul_p } {
                apm_callback_and_log $callback "<ul>\n"
                set ul_p 1
            }
            apm_callback_and_log $callback "<li>Loading data model $path/$file_path...\n<blockquote><pre>\n"
            db_source_sql_file -callback $callback $path/$file_path
            apm_callback_and_log $callback "</pre></blockquote>\n"
        } elseif$file_type eq "sqlj_code" } {
            if { !$ul_p } {
                apm_callback_and_log $callback "<ul>\n"
                set ul_p 1
            }
            apm_callback_and_log $callback "<li>Loading SQLJ code $path/$file_path...\n<blockquote><pre>\n"
            db_source_sqlj_file -callback $callback "$path/$file_path"
            apm_callback_and_log $callback "</pre></blockquote>\n"
        } elseif {$file_type eq "ctl_file"} {
            ns_log Debug "apm_package_install_data_model: Now processing $file_path of type ctl_file"
            if { !$ul_p } {
                apm_callback_and_log $callback "<ul>\n"
                set ul_p 1
            }
            apm_callback_and_log $callback "<li>Loading data file $path/$file_path...\n<blockquote><pre>\n"
            db_load_sql_data -callback $callback $path/$file_path
            apm_callback_and_log $callback "</pre></blockquote>\n"
        }
    }

    if {$ul_p} {
        apm_callback_and_log $callback "</ul><p>"
    }

    if { [llength $data_model_files] } {
        #Installations/upgrades are done in a separate process, making
        #changes that could affect our sessions.  This is particularly a
        #problem with the content_item package on Oracle.  To be on the safe
        #side we refresh the db connections after each install/upgrade.
        ns_log Debug "apm_package_install_data_model: Bouncing db pools."
        db_bounce_pools
    }
Generic XQL file:
packages/acs-tcl/tcl/apm-install-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-install-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-install-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: