ref_countries::apm::after_upgrade (private)

 ref_countries::apm::after_upgrade -from_version_name from_version_name \
    -to_version_name to_version_name

Defined in packages/ref-countries/tcl/apm-callback-procs.tcl

Switches:
-from_version_name (required)
-to_version_name (required)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_upgrade_logic apm_upgrade_logic (public) db_dml db_dml (public) db_string db_string (public) ref_countries::apm::after_upgrade ref_countries::apm::after_upgrade ref_countries::apm::after_upgrade->apm_upgrade_logic ref_countries::apm::after_upgrade->db_dml ref_countries::apm::after_upgrade->db_string

Testcases:
No testcase defined.
Source code:
    apm_upgrade_logic  -from_version_name $from_version_name  -to_version_name $to_version_name  -spec {
            5.6.0d1 5.6.0d2 {

                set new_countries {"ÅLAND ISLANDS" AX
                    "BOLIVIA, PLURINATIONAL STATE OF" BO
                    "CÔTE D'IVOIRE" CI
                    "GUERNSEY" GG
                    "ISLE OF MAN" IM
                    "JERSEY" JE
                    "KAZAKHSTAN" KZ
                    "MACAO" MO
                    "MONTENEGRO" ME
                    "RÉUNION" RE
                    "SAINT BARTHÉLEMY" BL
                    "SAINT MARTIN" MF
                    "SERBIA" RS
                    "TIMOR-LESTE" TL
                    "VENEZUELA, BOLIVARIAN REPUBLIC OF" VE}

                foreach {name code} $new_countries {
                    set exists_p [db_string get_country {select count(*) from countries where iso = :code} -default 0]

                    if { $exists_p } {
                        db_dml update_country {
                            update countries set default_name = :name
                            where iso = :code
                        }
                    } else {
                        db_dml insert_country {
                            insert into countries (iso, default_name)
                            values (:code, :name)
                        }
                    }
                }
            }
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: