Skip to main content

note_replace_if_unchanged_statement

Function note_replace_if_unchanged_statement 

Source
pub fn note_replace_if_unchanged_statement(
    note: &Note,
    expected_updated_at: i64,
    expected_deleted_at: Option<i64>,
) -> SqlStatement
Expand description

Full-note compare-and-swap update used after caller-side normalization was derived from a read snapshot. Unlike note_upsert_statement, this never inserts and cannot overwrite a row whose revision or deletion marker moved after the snapshot was read. The replacement revision must also be strictly greater than the persisted snapshot revision; equality is a refused CAS, never a successful write with an unchanged concurrency token.