jruby/activerecord-jdbc-adapter — pull request #199 by dlitz (2012-06-15 03:34:39+00:00)
Title: mssql: Fix pessimistic locking

This fixes the error:

ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.

when executing code like this:

Entry.lock(true).all

Before, it would generate SQL like this:

SELECT [entries].* FROM [entries] FOR UPDATE WITH(ROWLOCK,UPDLOCK)

Now, it generates SQL like this:

SELECT [entries].* FROM [entries] WITH(ROWLOCK,UPDLOCK)