提交 434ec237 编写于 作者: S Sean Griffin

Merge pull request #23048 from kamipo/substitute_at_is_no_longer_used

`substitute_at` is no longer used
......@@ -74,9 +74,8 @@ def join_constraints(foreign_table, foreign_klass, node, join_type, tables, scop
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 @@ def index_algorithms
{}
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 @@ def substitute_values(values) # :nodoc:
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 @@ def test_exec_typecasts_bind_vals
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 @@ def test_encoding
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 @@ def test_bind_from_join_in_subquery
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}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册