BabelKit Code Table Update Methods

These methods update the code table. They never call commit in order to not disturb any transactions in progress. If the library handle that you provide to BabelKit is not set up to autocommit, call commit yourself after calling these methods.


$babelkit->slave($code_set, $code_code, $code_desc);

The slave() method creates, updates, or deletes a native code description. This is convenient for situations where some legacy database fields need to become multilingual. The native language value can be kept and maintained in the legacy database field while the translations can be kept and maintained in the BabelKit code table.

Call the slave() method to update the code table whenever the native language value in the legacy table changes.

Calling slave() with a blank description will delete the code entirely. Or you can call the remove() method when a master record is being deleted.

$babelkit->slave('city', $city_id, $city_name);


$babelkit->remove($code_set, $code_code);

The remove() method removes all language descriptions for a code. This can be useful for removing obsolete code translations from a slave set. It can also be useful to force retranslation of a slave item.

$babelkit->remove('city_id', $city_id);


list( $code_desc, $code_order, $code_flag ) =
    $babelkit->get($code_set, $code_lang, $code_code);
# Perl
( $code_desc, $code_order, $code_flag ) =
    $babelkit->get($code_set, $code_lang, $code_code);
This is an internal method used to retrieve all of a code's fields.


$babelkit->put($code_set,  $code_lang,  $code_code,
                  $code_desc, $code_order, $code_flag);
This is an internal method used to write all of a code's fields. The code is added, updated or deleted as necessary. Putting a blank native description will remove() the entire code. Putting a blank non-native description will delete that language translation record.

The code_order and code_flag parameters are optional.

When a code is first added in the native language and the code_order parameter is missing or undefined and the code_code value is numeric then the code_code value is entered into the code_order field. This supports numeric sorts on numeric codes by default.