New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
2 participants
@balazs-zsoldos
Contributor

balazs-zsoldos commented Jul 21, 2015

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jul 21, 2015

Member

Thanks for the issue! Implemented as suggested.

Member

timowest commented Jul 21, 2015

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