Skip to content
Browse files

Handle multiline sql when adding limit offset

  • Loading branch information...
1 parent 9700856 commit 273f6c515b9a7cfc15b8fc895b43919b5eaefd61 @jcosmo jcosmo committed May 30, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/jdbc_adapter/jdbc_mssql.rb
View
2 lib/jdbc_adapter/jdbc_mssql.rb
@@ -233,7 +233,7 @@ def add_limit_offset!(sql, options)
end_row = offset + limit.to_i
order = (options[:order] || determine_order_clause(sql))
sql.sub!(/ ORDER BY.*$/i, '')
- find_select = /\b(SELECT(?:\s+DISTINCT)?)\b(.*)/i
+ find_select = /\b(SELECT(?:\s+DISTINCT)?)\b(.*)/im
whole, select, rest_of_query = find_select.match(sql).to_a
if (start_row == 1) && (end_row ==1)
new_sql = "#{select} TOP 1 #{rest_of_query}"

0 comments on commit 273f6c5

Please sign in to comment.
Something went wrong with that request. Please try again.