1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

substitute_at is no longer used

Arel handles substitution for bind parameters by now.
This commit is contained in:
Ryuta Kamizono 2016-01-14 09:59:26 +09:00
parent f5ab4055b9
commit a557ab00f5
6 changed files with 3 additions and 20 deletions

View file

@ -74,9 +74,8 @@ module ActiveRecord
value = foreign_klass.base_class.name
column = klass.columns_hash[reflection.type.to_s]
substitute = klass.connection.substitute_at(column)
binds << Relation::QueryAttribute.new(column.name, value, klass.type_for_attribute(column.name))
constraint = constraint.and table[reflection.type].eq substitute
constraint = constraint.and table[reflection.type].eq(Arel::Nodes::BindParam.new)
end
joins << table.create_join(table, table.create_on(constraint), join_type)

View file

@ -311,12 +311,6 @@ module ActiveRecord
{}
end
# Returns a bind substitution value given a bind +column+
# NOTE: The column param is currently being used by the sqlserver-adapter
def substitute_at(column, _unused = 0)
Arel::Nodes::BindParam.new
end
# REFERENTIAL INTEGRITY ====================================
# Override to turn off referential integrity while executing <tt>&block</tt>.

View file

@ -99,7 +99,7 @@ module ActiveRecord
end
substitutes = values.map do |(arel_attr, _)|
[arel_attr, connection.substitute_at(klass.columns_hash[arel_attr.name])]
[arel_attr, Arel::Nodes::BindParam.new]
end
[substitutes, binds]

View file

@ -322,11 +322,6 @@ module ActiveRecord
end
end
def test_substitute_at
bind = @connection.substitute_at(nil)
assert_equal Arel.sql('$1'), bind.to_sql
end
def test_partial_index
with_example_table do
@connection.add_index 'ex', %w{ id number }, :name => 'partial', :where => "number > 100"

View file

@ -130,11 +130,6 @@ module ActiveRecord
assert_equal 'UTF-8', @conn.encoding
end
def test_bind_value_substitute
bind_param = @conn.substitute_at('foo')
assert_equal Arel.sql('?'), bind_param.to_sql
end
def test_exec_no_binds
with_example_table 'id int, data string' do
result = @conn.exec_query('SELECT id, data FROM ex')

View file

@ -39,7 +39,7 @@ module ActiveRecord
end
def test_binds_are_logged
sub = @connection.substitute_at(@pk)
sub = Arel::Nodes::BindParam.new
binds = [Relation::QueryAttribute.new("id", 1, Type::Value.new)]
sql = "select * from topics where id = #{sub.to_sql}"