Skip to content

Commit f7a5af6

Browse files
adzaph-lame
authored andcommitted
Changing to a single regexp for the detection of 'INSERT ... DEFAULT VALUES' style of sql insert.
1 parent f91656d commit f7a5af6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def set_utf8_values!(sql)
940940
utf8_cols.each do |col|
941941
sql.gsub!("[#{col.to_s}] = '", "[#{col.to_s}] = N'")
942942
end
943-
elsif sql =~ /^\s*INSERT/i and sql !~ /DEFAULT VALUES\s*$/i
943+
elsif sql =~ /^\s*INSERT(?!.*DEFAULT VALUES\s*$)/i
944944
# TODO This code should be simplified
945945
# Get columns and values, split them into arrays, and store the original_values for when we need to replace them
946946
columns_and_values = sql.scan(/\((.*?)\)/m).flatten

0 commit comments

Comments
 (0)