aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-12 13:57:05 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-26 13:44:07 -0700
commit497218d5db8f7c3887c3861bdbe318331b77fed7 (patch)
tree08de5ec8b12ec9eeb8172f1361ecd80a67fdb600 /activerecord
parentef0cf143a939772edd89f90b0a095c8eb65139d2 (diff)
downloadrails-497218d5db8f7c3887c3861bdbe318331b77fed7.tar.gz
rails-497218d5db8f7c3887c3861bdbe318331b77fed7.tar.bz2
rails-497218d5db8f7c3887c3861bdbe318331b77fed7.zip
adding bind value substitution
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb6
-rw-r--r--activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb9
2 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index d8c92d0ad3..bcbef526bd 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -97,6 +97,12 @@ module ActiveRecord
quote_column_name(name)
end
+ # Returns a bind substitution value given a +column+ and list of current
+ # +bind_values+
+ def substitute_for(column, bind_values)
+ Arel.sql '?'
+ end
+
# REFERENTIAL INTEGRITY ====================================
# Override to turn off referential integrity while executing <tt>&block</tt>.
diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
index 934cf72f72..f4a856e42a 100644
--- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
+++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
@@ -51,6 +51,15 @@ module ActiveRecord
:timeout => 100
assert_equal 'UTF-8', conn.encoding
end
+
+ def test_bind_value_substitute
+ conn = Base.sqlite3_connection :database => ':memory:',
+ :adapter => 'sqlite3',
+ :timeout => 100
+
+ bind_param = conn.substitute_for('foo', [])
+ assert_equal Arel.sql('?'), bind_param
+ end
end
end
end