lib/upsert/connection.rb in upsert-1.0.2 vs lib/upsert/connection.rb in upsert-1.1.0

- old
+ new

@@ -1,37 +1,35 @@ class Upsert # @private class Connection attr_reader :controller - attr_reader :raw_connection + attr_reader :metal - def initialize(controller, raw_connection) + def initialize(controller, metal) @controller = controller - @raw_connection = raw_connection + @metal = metal end - - def quote_value(v) + + def convert_binary(bind_values) + bind_values.map do |v| + case v + when Upsert::Binary + binary v + else + v + end + end + end + + def bind_value(v) case v - when NilClass - NULL_WORD - when Upsert::Binary - quote_binary v.value # must be defined by base - when String - quote_string v # must be defined by base - when TrueClass, FalseClass - quote_boolean v - when BigDecimal - quote_big_decimal v - when Numeric - v - when Symbol - quote_string v.to_s when Time, DateTime - quote_time v # must be defined by base + Upsert.utc_iso8601 v when Date - quote_string v.strftime(ISO8601_DATE) + v.strftime ISO8601_DATE else - raise "not sure how to quote #{v.class}: #{v.inspect}" + v end end + end end