Add support for OF in row lock clauses

This adds support for statements such as `SELECT ... FOR UPDATE OF table NOWAIT` where `OF table`
could not be specified previously. Fixes #285.
This commit is contained in:
Matthew Dowdell 2023-11-30 07:52:54 +00:00
parent 6a13530ec1
commit f16f0b5e5d
4 changed files with 48 additions and 1 deletions

View file

@ -2251,6 +2251,18 @@ FOR`
}
}
func TestRowLockWithJoins(t *testing.T) {
query := SELECT(STAR).
FROM(
Film.
INNER_JOIN(FilmCategory, FilmCategory.FilmID.EQ(Film.FilmID)).
LEFT_JOIN(FilmActor, FilmActor.FilmID.EQ(Film.FilmID))).
LIMIT(1).
FOR(UPDATE().OF(Film, FilmCategory).NOWAIT())
testutils.AssertExecAndRollback(t, query, db, 1)
}
func TestQuickStart(t *testing.T) {
var expectedSQL = `