Skip to content

Commit 9c6bdcc

Browse files
committed
Revert "Merge pull request rails#52464 from Shopify/sql-for-insert-no-binds"
This reverts commit e7e2587, reversing changes made to 310aa1a. Actually, this is used by the oracle-enhanced adapter: https://github.com/rsim/oracle-enhanced/blob/750004962c356f9e481418664806f538b364621f/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb#L83 We should at the very least give them a noticed before removing, but it's not critical and can stay.
1 parent e7e2587 commit 9c6bdcc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def exec_query(sql, name = "SQL", binds = [], prepare: false)
155155
# `nil` is the default value and maintains default behavior. If an array of column names is passed -
156156
# the result will contain values of the specified columns from the inserted row.
157157
def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil, returning: nil)
158-
sql = sql_for_insert(sql, pk, returning)
158+
sql, binds = sql_for_insert(sql, pk, binds, returning)
159159
internal_exec_query(sql, name, binds)
160160
end
161161

@@ -707,7 +707,7 @@ def select(sql, name = nil, binds = [], prepare: false, async: false, allow_retr
707707
end
708708
end
709709

710-
def sql_for_insert(sql, pk, returning) # :nodoc:
710+
def sql_for_insert(sql, pk, binds, returning) # :nodoc:
711711
if supports_insert_returning?
712712
if pk.nil?
713713
# Extract the table from the insert sql. Yuck.
@@ -721,7 +721,7 @@ def sql_for_insert(sql, pk, returning) # :nodoc:
721721
sql = "#{sql} RETURNING #{returning_columns_statement}" if returning_columns.any?
722722
end
723723

724-
sql
724+
[sql, binds]
725725
end
726726

727727
def last_inserted_id(result)

activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module ConnectionAdapters
55
module Trilogy
66
module DatabaseStatements
77
def exec_insert(sql, name, binds, pk = nil, sequence_name = nil, returning: nil) # :nodoc:
8-
sql = sql_for_insert(sql, pk, returning)
8+
sql, _binds = sql_for_insert(sql, pk, binds, returning)
99
internal_execute(sql, name)
1010
end
1111

0 commit comments

Comments
 (0)