Sha256: 5a52c3260877e087a142d61fcc273b13b57c4b87d685b117e900d39b13222446

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

class Upsert
  class Cell
    # @private
    class PG_Connection < Cell
      attr_reader :name
      attr_reader :value
      attr_reader :quoted_name

      def initialize(connection, name, value)
        @name = name
        @value = value
        @quoted_name = connection.quote_ident name
      end

      def bind_value
        return @bind_value if defined?(@bind_value)
        @bind_value = case value
        when Upsert::Binary
          { :value => value.value, :format => 1 }
        when Time, DateTime
          [value.strftime(ISO8601_DATETIME), sprintf(USEC_SPRINTF, value.usec)].join('.')
        else
          value
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upsert-1.0.2 lib/upsert/cell/PG_Connection.rb
upsert-0.5.0 lib/upsert/cell/pg_connection.rb