@@ -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
@@ -42,25 +48,6 @@ def exec_update(sql, name = nil, binds = NO_BINDS)
42
48
end
43
49
alias :exec_delete :exec_update
44
50
45
- # overridden to support legacy binds
46
- def insert ( arel , name = nil , pk = nil , id_value = nil , sequence_name = nil , binds = [ ] )
47
- binds = convert_legacy_binds_to_attributes ( binds ) if binds . first . is_a? ( Array )
48
- super
49
- end
50
- alias create insert
51
-
52
- # overridden to support legacy binds
53
- def update ( arel , name = nil , binds = [ ] )
54
- binds = convert_legacy_binds_to_attributes ( binds ) if binds . first . is_a? ( Array )
55
- super
56
- end
57
-
58
- # overridden to support legacy binds
59
- def delete ( arel , name = nil , binds = [ ] )
60
- binds = convert_legacy_binds_to_attributes ( binds ) if binds . first . is_a? ( Array )
61
- super
62
- end
63
-
64
51
def execute ( sql , name = nil )
65
52
log ( sql , name ) { @connection . execute ( sql ) }
66
53
end
0 commit comments