Skip to content

UPDATE WHERE from a Record type (optimistic concurrency control) #1443

Answered by groue
bok- asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @bok-,

I can't see a way to customise the WHERE clause when working with a Record,

Indeed GRDB provides no way to customize the WHERE clause of the UPDATE statements generated by the update family of record instance methods. It is made of the primary key and only the primary key.

I can do that using the query interface directly.

:-) Indeed it is always possible to talk to the database.

But I have difficulties figuring out what your technique can be. The only updating method that allows configuration of the WHERE clause is the request.updateAll(db, assignments) method. Maybe you write something as below?

// UPDATE player
// SET name = ..., score = ...
// WHERE id = xxx and checks…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@groue
Comment options

@groue
Comment options

@bok-
Comment options

@bok-
Comment options

@groue
Comment options

Answer selected by bok-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants