File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
lib/active_record/connection_adapters/sqlserver/core_ext Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def unprepare_sqlserver_statement(sql)
2323 executesql_args = executesql . split ( ', ' )
2424 found_args = executesql_args . reject! { |arg | arg =~ SQLSERVER_PARAM_MATCHER }
2525 executesql_args . pop if found_args && executesql_args . many?
26- executesql = executesql_args . join ( ', ' ) . strip . match ( /N'(.*)'/ ) [ 1 ]
26+ executesql = executesql_args . join ( ', ' ) . strip . match ( /N'(.*)'/m ) [ 1 ]
2727 Utils . unquote_string ( executesql )
2828 else
2929 sql
Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ class ShowplanTestSqlserver < ActiveRecord::TestCase
1212 assert plan . starts_with? ( "EXPLAIN for: SELECT [cars].* FROM [cars] WHERE [cars].[id] = 1" )
1313 assert plan . include? ( "Clustered Index Seek" ) , 'make sure we do not showplan the sp_executesql'
1414 end
15+
16+ should 'from multiline statement' do
17+ plan = Car . where ( "\n id = 1 \n " ) . explain
18+ assert plan . starts_with? ( "EXPLAIN for: SELECT [cars].* FROM [cars] WHERE (\n id = 1 \n )" )
19+ assert plan . include? ( "Clustered Index Seek" ) , 'make sure we do not showplan the sp_executesql'
20+ end
1521
1622 should 'from prepared statement' do
1723 plan = capture_logger do
You can’t perform that action at this time.
0 commit comments