build_swelling_states() – Rebuild the SWELLING_STATES table

Synopsis

build_swelling_states() INT
build_swelling_states(animid TEXT) INT

Input

animid

A BIOGRAPHY_DATA.AnimID value, designating the individual which is to have its SWELLING_STATES rows recomputed.

This value is not validated. The BIOGRAPHY_DATA.AnimID of a male, or any other individual with no swelling data, or even a non-existent AnimID, may be specified and the function will execute without error.

The function’s return value may be examined to determine whether changes were made to SWELLING_STATES.

Description

Rebuild the SWELLING_STATES table’s rows, either all of them or those of only one individual.

When this function is called without an argument, it re-computes the entire SWELLING_STATES table. This is done by examining all data associated with all BIOGRAPHY_DATA rows having a F BIOGRAPHY_DATA.Sex value.

When called with a BIOGRAPHY_DATA.AnimID value, it re-computes the SWELLING_STATES rows belonging to the given individual.

Re-computation begins by deleting those rows on SWELLING_STATES associated with the individual(s) who’s swelling states were re-computed. This provides a way to remove rows associated with an individual who was erroneously marked female.

The columns within SokweDB from which swelling information is obtained are:

Each of ARRIVALS_A, ARRIVALS, and MATINGS should have a corresponding special value in SIGHTING_RECORDS.[1] This enables the “ranking” of swelling information to control the selection of which source to use when identical swelling information appears in more than one place.

When the minimum or maximum value appears in more than one of the above tables, the source recorded in SWELLING_SOURCES.Source is that with the smallest SIGHTING_RECORDS.Priority value.

The CYCLE_STATES codes to appear in SWELLING_STATES, and the ranking of the codes, is determined by the CYCLE_STATES.SSRank column.

Examples

Rebuild SWELLING_STATES for the individual with the AnimID of “JANE”
SELECT build_swelling_states('JANE');
Rebuild the entire SWELLING_STATES table
SELECT build_swelling_states();

Return Value

The function returns the number of rows computed, regardless of how many rows previously existed in SWELLING_STATES.

Footnotes

Page last generated: 2026-08-05 22:49:54 UTC