2009/7/13 Jesse <pianohacker@gmail.com>
2009/7/13 Sébastien Hinderer <Sebastien.Hinderer@snv.jussieu.fr>
I'm wondering how occurrences of authorised values are represented in Koha's database. I'm aware of the authorised_values table, but that's not my concern here. Assume one decides to bind a Koha field to an authorised value. My question is: what will finally be stored in that field ? Will it be the primary key associated to the authorised value (id), or will it be the content of the authorised_value column ? In the latter case, if this value changes, how is it updated ? Thanks a lot for any help, Sébastien.
I don't think the authorised_values table has an id column. The authorised_value column, which usually contains a code (like DISP or 3, depending on where the value is used), serves as the primary key, and is what is stored in whatever column references the authorized value (such as items.location or items.itemlost). The description of the particular authorized value is stored in the authorised_values table, and always fetched from there.
There is a numerical "id" column: mysql> describe authorised_values; +------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | category | varchar(10) | NO | MUL | | | | authorised_value | varchar(80) | NO | | | | | lib | varchar(80) | YES | MUL | NULL | | | imageurl | varchar(200) | YES | | NULL | | +------------------+--------------+------+-----+---------+----------------+ 5 rows in set (0.01 sec) Example rows: mysql> select * from authorised_values LIMIT 4; +----+------------+------------------+----------------------------------------------------------------------------------+----------+ | id | category | authorised_value | lib | imageurl | +----+------------+------------------+----------------------------------------------------------------------------------+----------+ | 1 | UNIT_TYPE | 0 | Information not available; Not applicable | NULL | | 2 | UNIT_TYPE | a | Basic bibliographic unit | NULL | | 3 | UNIT_TYPE | c | Secondary bibliographic unit: supplements, special issues, accompanying material | NULL | | 5 | PHYS_FORMS | au | Cartographic material | NULL | +----+------------+------------------+----------------------------------------------------------------------------------+----------+ 5 rows in set (0.00 sec) But I'm not sure how/when the "id" is used. The authorised value itself is typically what is in the linked record. -- Joe Atzberger LibLime - Open Source Library Solutions