提交 5465508a 编写于 作者: R Ryuta Kamizono

Remove `prepare_binds_for_database` internal method

To avoid relying on the connection adapter for type casting binds.
上级 4211a299
......@@ -316,7 +316,7 @@ def insert_fixture(fixture, table_name)
end
end
key_list = fixture.keys.map { |name| quote_column_name(name) }
value_list = prepare_binds_for_database(binds).map do |value|
value_list = binds.map(&:value_for_database).map do |value|
begin
quote(value)
rescue TypeError
......
......@@ -150,10 +150,6 @@ def quoted_time(value) # :nodoc:
quoted_date(value).sub(/\A2000-01-01 /, '')
end
def prepare_binds_for_database(binds) # :nodoc:
binds.map(&:value_for_database)
end
private
def type_casted_binds(binds)
......
......@@ -130,7 +130,7 @@ def <=>(version_string)
class BindCollector < Arel::Collectors::Bind
def compile(bvs, conn)
casted_binds = conn.prepare_binds_for_database(bvs)
casted_binds = bvs.map(&:value_for_database)
super(casted_binds.map { |value| conn.quote(value) })
end
end
......
......@@ -49,8 +49,8 @@ def initialize(values)
def sql_for(binds, connection)
val = @values.dup
binds = connection.prepare_binds_for_database(binds)
@indexes.each { |i| val[i] = connection.quote(binds.shift) }
casted_binds = binds.map(&:value_for_database)
@indexes.each { |i| val[i] = connection.quote(casted_binds.shift) }
val.join
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册