ref_language::set_data (public)

 ref_language::set_data -label label [ -iso1 iso1 ] [ -iso2 iso2 ]

Defined in packages/ref-language/tcl/ref-language-procs.tcl

Add new ISO-639 language codes (3 chars and 2 chars) where they don't exist, update them otherwise.

Switches:
-label (required)
-iso1 (optional)
-iso2 (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_ref_language__set_data ref_language__set_data (test ref-language) ref_language::set_data ref_language::set_data test_ref_language__set_data->ref_language::set_data db_dml db_dml (public) ref_language::set_data->db_dml db_string db_string (public) ref_language::set_data->db_string ref_language::set_iso1 ref_language::set_iso1 (private) ref_language::set_data->ref_language::set_iso1 ref_language::apm::add_language_639_2_codes ref_language::apm::add_language_639_2_codes (private) ref_language::apm::add_language_639_2_codes->ref_language::set_data ref_language::apm::after_upgrade ref_language::apm::after_upgrade (private) ref_language::apm::after_upgrade->ref_language::set_data

Testcases:
ref_language__set_data
Source code:

    if { $iso1 eq "" && $iso2 eq "" } {

        error "you need to provide either a 2 chars or a 3 chars language code"

    } else {

        if { $iso2 ne "" } {
            set exists_p [db_string get_lang {} -default 0]

            if { $exists_p } {
                db_dml update_lang {}
            } else {
                db_dml insert_lang {}
            }
        }

        if { $iso1 ne "" } {
            ref_language::set_iso1 -code $iso1 -name $label
        }
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="ref_language::set_data.get_lang">
    <querytext>

      select count(*) 
      from language_639_2_codes 
      where iso_639_2 = :iso2

    </querytext>
</fullquery>

<fullquery name="ref_language::set_data.update_lang">
    <querytext>

      update language_639_2_codes 
      set label = :label, iso_639_1 = :iso1
      where iso_639_2 = :iso2

    </querytext>
</fullquery>

<fullquery name="ref_language::set_data.insert_lang">
    <querytext>

      insert into language_639_2_codes 
      (iso_639_2, iso_639_1, label)
      values
      (:iso2, :iso1, :label)

    </querytext>
</fullquery>
packages/ref-language/tcl/ref-language-procs.xql

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