Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created April 21, 2009 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaskills/99099 to your computer and use it in GitHub Desktop.
Save metaskills/99099 to your computer and use it in GitHub Desktop.
should 'not add locking conditions to sub selects' do
start_sql = "SELECT * FROM [people] WHERE ([people].[id] = 1) AND (id IN (SELECT id FROM CONTAINSTABLE(people,*,'test')))"
expected_sql = "SELECT * FROM [people] WITH (NOLOCK) WHERE ([people].[id] = 1) AND (id IN (SELECT id FROM CONTAINSTABLE(people,*,'test')))"
assert_equal expected_sql, Person.connection.send(:add_lock!,start_sql,{:lock => 'WITH (NOLOCK)'})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment