Repository navigation
v1.95.0 - Alya
[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()andsharedLock(). On
db($context)->table(...)andModel::query($context), they add the locking clause for the
connection's database afterLIMIT/OFFSET. PostgreSQL getsFOR UPDATE/FOR SHARE, MySQL
getsFOR 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 insidetransaction(). 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 inRefreshTokenStorenow uses
it.
Fixed
- A locking read is never served from the query cache. The cache skipped only
FOR UPDATE
queries, so a cachedFOR SHAREorLOCK IN SHARE MODEread came back without taking its lock.
It now skips every locking clause, and a lockingget()bypassescache(). paginate()works on a query that already has a limit and an offset. The pattern that
removes the existingLIMITleftOFFSET nbehind, so the page query was invalid SQL. It also
keeps a lock clause after the newLIMIT ? OFFSET ?, and the count query drops it (PostgreSQL
rejectsFOR UPDATEalongsideCOUNT(*)).
Upgrade Notes
QueryStateInterfacegainssetLock()/getLock(),SelectBuilderInterfacegains
buildLockClause(), andQueryBuilderInterfacegainslockForUpdate()/sharedLock(). A
custom implementation of any of these interfaces needs the new methods; code that only calls
the builder is unaffected.