Skip to content

v1.95.0 - Alya

Choose a tag to compare

@MichaelSowah MichaelSowah released this 03 Dec 02:41
· 2 commits to main since this release
208630c

[1.95.0] - 2026-12-03 — Alya

Row locks in the query builder, the same clause for hand-written SQL, and two fixes that make
locked and pre-limited queries page and cache correctly.

Added

  • Row locks in the query builder: lockForUpdate() and sharedLock(). On
    db($context)->table(...) and Model::query($context), they add the locking clause for the
    connection's database after LIMIT/OFFSET. PostgreSQL gets FOR UPDATE / FOR SHARE, MySQL
    gets FOR UPDATE / LOCK IN SHARE MODE (accepted by 5.7 and 8.x), and SQLite gets no clause:
    a SQLite write transaction already locks the whole database. The lock lasts until the
    transaction ends, so a locking read belongs inside transaction().
  • Glueful\Database\Query\RowLock, the clause for hand-written SQL.
    RowLock::clause(db($context)->getDriverName(), RowLock::UPDATE) returns the same clause the
    builder uses, so raw queries no longer need their own per-driver check. An unknown driver gets
    no clause instead of a syntax error. The refresh-token rotation in RefreshTokenStore now uses
    it.

Fixed

  • A locking read is never served from the query cache. The cache skipped only FOR UPDATE
    queries, so a cached FOR SHARE or LOCK IN SHARE MODE read came back without taking its lock.
    It now skips every locking clause, and a locking get() bypasses cache().
  • paginate() works on a query that already has a limit and an offset. The pattern that
    removes the existing LIMIT left OFFSET n behind, so the page query was invalid SQL. It also
    keeps a lock clause after the new LIMIT ? OFFSET ?, and the count query drops it (PostgreSQL
    rejects FOR UPDATE alongside COUNT(*)).

Upgrade Notes

  • QueryStateInterface gains setLock() / getLock(), SelectBuilderInterface gains
    buildLockClause(), and QueryBuilderInterface gains lockForUpdate() / sharedLock(). A
    custom implementation of any of these interfaces needs the new methods; code that only calls
    the builder is unaffected.