Skip to main content

RELEASE_PINS

Constant RELEASE_PINS 

Source
pub const RELEASE_PINS: &str = "\
UPDATE objects SET refcount = refcount - \
  (SELECT count(*) FROM json_each(:hashes) WHERE value = objects.hash) \
WHERE hash IN (SELECT value FROM json_each(:hashes))";
Expand description

Releases one reference from each of the given hashes (a JSON array), the set-based form of ADJUST_REFCOUNT at -1.

A hash listed twice releases twice, which is what makes it the same operation as the loop it replaces: a retained item pins its body and its conflict body separately, and a purge releases both.