Skip to content

Commit 65295f8

Browse files
committed
[postgres] allow legacy binds
This is already supported in 52.x and higher.
1 parent 3d27889 commit 65295f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/arjdbc/abstract/database_statements.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module DatabaseStatements
1010
NO_BINDS = [].freeze
1111

1212
def exec_insert(sql, name = nil, binds = NO_BINDS, pk = nil, sequence_name = nil)
13+
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
14+
1315
if without_prepared_statement?(binds)
1416
log(sql, name) { @connection.execute_insert(sql) }
1517
else
@@ -22,6 +24,8 @@ def exec_insert(sql, name = nil, binds = NO_BINDS, pk = nil, sequence_name = nil
2224
# It appears that at this point (AR 5.0) "prepare" should only ever be true
2325
# if prepared statements are enabled
2426
def exec_query(sql, name = nil, binds = NO_BINDS, prepare: false)
27+
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
28+
2529
if without_prepared_statement?(binds)
2630
log(sql, name) { @connection.execute_query(sql) }
2731
else
@@ -34,6 +38,8 @@ def exec_query(sql, name = nil, binds = NO_BINDS, prepare: false)
3438
end
3539

3640
def exec_update(sql, name = nil, binds = NO_BINDS)
41+
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
42+
3743
if without_prepared_statement?(binds)
3844
log(sql, name) { @connection.execute_update(sql) }
3945
else

0 commit comments

Comments
 (0)