1
0
Fork 0
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:
Aaron Patterson 2011-04-13 16:28:23 -07:00
parent a22ceaeefa
commit 0268eac963

View file

@ -282,6 +282,17 @@ module ActiveRecord
end end
alias :create :insert_sql 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) def update_sql(sql, name = nil)
super super
@connection.affected_rows @connection.affected_rows