@@ -10,6 +10,8 @@ module DatabaseStatements
10
10
NO_BINDS = [ ] . freeze
11
11
12
12
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
+
13
15
if without_prepared_statement? ( binds )
14
16
log ( sql , name ) { @connection . execute_insert ( sql ) }
15
17
else
@@ -22,6 +24,8 @@ def exec_insert(sql, name = nil, binds = NO_BINDS, pk = nil, sequence_name = nil
22
24
# It appears that at this point (AR 5.0) "prepare" should only ever be true
23
25
# if prepared statements are enabled
24
26
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
+
25
29
if without_prepared_statement? ( binds )
26
30
log ( sql , name ) { @connection . execute_query ( sql ) }
27
31
else
@@ -34,6 +38,8 @@ def exec_query(sql, name = nil, binds = NO_BINDS, prepare: false)
34
38
end
35
39
36
40
def exec_update ( sql , name = nil , binds = NO_BINDS )
41
+ binds = convert_legacy_binds_to_attributes ( binds ) if binds . first . is_a? ( Array )
42
+
37
43
if without_prepared_statement? ( binds )
38
44
log ( sql , name ) { @connection . execute_update ( sql ) }
39
45
else
0 commit comments