diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-30 17:26:42 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-30 17:27:46 -0700 |
commit | 1d7c0336ef18cfde7b55911f60d912b5feba2b68 (patch) | |
tree | fe63e8b3db669ff8d07b9da786a28c2f394414ff /activerecord/lib/active_record/connection_adapters/abstract | |
parent | e14e696e9627b0e7fb903bc31b2b72070773c0a9 (diff) | |
download | rails-1d7c0336ef18cfde7b55911f60d912b5feba2b68.tar.gz rails-1d7c0336ef18cfde7b55911f60d912b5feba2b68.tar.bz2 rails-1d7c0336ef18cfde7b55911f60d912b5feba2b68.zip |
using bind parameters for updates
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 6d52cc344d..3045e30407 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -55,20 +55,27 @@ module ActiveRecord def exec_query(sql, name = 'SQL', binds = []) end - # Executes insert +sql+ statement in the context of this connection using + # Executes insert +sql+ statement in the context of this connection using # +binds+ as the bind substitutes. +name+ is the logged along with # the executed +sql+ statement. def exec_insert(sql, name, binds) exec_query(sql, name, binds) end - # Executes delete +sql+ statement in the context of this connection using + # Executes delete +sql+ statement in the context of this connection using # +binds+ as the bind substitutes. +name+ is the logged along with # the executed +sql+ statement. def exec_delete(sql, name, binds) exec_query(sql, name, binds) end + # Executes update +sql+ statement in the context of this connection using + # +binds+ as the bind substitutes. +name+ is the logged along with + # the executed +sql+ statement. + def exec_update(sql, name, binds) + exec_query(sql, name, binds) + end + # Returns the last auto-generated ID from the affected table. # # +id_value+ will be returned unless the value is nil, in @@ -84,8 +91,8 @@ module ActiveRecord end # Executes the update statement and returns the number of rows affected. - def update(sql, name = nil) - update_sql(sql, name) + def update(sql, name = nil, binds = []) + exec_update(sql, name, binds) end # Executes the delete statement and returns the number of rows affected. |