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:
parent
f5ab4055b9
commit
a557ab00f5
6 changed files with 3 additions and 20 deletions
|
@ -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)
|
||||
|
|
|
@ -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>.
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue