sqlQuery.forUpdate() does not work on SQLServer #1446

Closed
balazs-zsoldos opened this Issue Jul 21, 2015 · 1 comment

Projects

None yet

2 participants

@balazs-zsoldos
Contributor

In case we have an SQLQuery and call query.forUpdate(), that does not work on SQLServer.

The reason is that while all other databases use the syntax:

SELECT... FROM...WHERE... FOR UPDATE

SQLServer uses the following:

SELECT ... FROM ... WITH (UPDLOCK) ... WHERE...

That means that pessimistic lock can be done with a Table Hint in SQLServer.

There is a class called SQLServerQuery and the hint can be added easily there. However, by using that class, the code will be database dependent.

It would be nice if sqlQuery.forUpdate() added a table hint instead of QueryFlag in case of SQLServer so the client code could be database independent.

@timowest
Member

Thanks for the issue! Implemented as suggested.

@timowest timowest added the progress label Jul 21, 2015
@Shredder121 Shredder121 closed this in #1448 Jul 29, 2015
@timowest timowest removed the progress label Jul 31, 2015
@timowest timowest added this to the 4.0.3 milestone Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment