mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
mimic prepared statements in the exec_insert for mysql2
This commit is contained in:
parent
a22ceaeefa
commit
0268eac963
1 changed files with 11 additions and 0 deletions
|
@ -282,6 +282,17 @@ module ActiveRecord
|
|||
end
|
||||
alias :create :insert_sql
|
||||
|
||||
def exec_insert(sql, name, binds)
|
||||
binds = binds.dup
|
||||
|
||||
# Pretend to support bind parameters
|
||||
execute sql.gsub('?') { quote(*binds.shift.reverse) }, name
|
||||
end
|
||||
|
||||
def last_inserted_id(result)
|
||||
@connection.last_id
|
||||
end
|
||||
|
||||
def update_sql(sql, name = nil)
|
||||
super
|
||||
@connection.affected_rows
|
||||
|
|
Loading…
Reference in a new issue