Skip to main content

UPDATE_SESSION_COUNTERS_SQL

Constant UPDATE_SESSION_COUNTERS_SQL 

Source
pub const UPDATE_SESSION_COUNTERS_SQL: &str = "
UPDATE sessions
SET last_seen_at = MAX(last_seen_at, ?1),
    total_calls  = total_calls + 1,
    total_errors = total_errors + ?2
WHERE session_id = ?3;
";
Expand description

UPDATE session counters and last_seen_at. Executed in the same transaction as the request INSERT to keep counters consistent.