module Sequel::Postgres::ExtendedDateSupport::DatasetMethods

Private Instance Methods

literal_date(date) click to toggle source

Handle BC Date objects.

Calls superclass method
    # File lib/sequel/extensions/pg_extended_date_support.rb
183 def literal_date(date)
184   if date < DATE_YEAR_1
185     date <<= ((date.year) * 24 - 12)
186     date.strftime("'%Y-%m-%d BC'")
187   else
188     super
189   end
190 end
literal_datetime(date) click to toggle source

Handle BC DateTime objects.

Calls superclass method
    # File lib/sequel/extensions/pg_extended_date_support.rb
193 def literal_datetime(date)
194   if date < DATETIME_YEAR_1
195     date <<= ((date.year) * 24 - 12)
196     date = db.from_application_timestamp(date)
197     minutes = (date.offset * 1440).to_i
198     date.strftime("'%Y-%m-%d %H:%M:%S.%N#{format_timestamp_offset(*minutes.divmod(60))} BC'")
199   else
200     super
201   end
202 end
literal_other_append(sql, v) click to toggle source

Handle Date::Infinity values

Calls superclass method
    # File lib/sequel/extensions/pg_extended_date_support.rb
205 def literal_other_append(sql, v)
206   if v.is_a?(Date::Infinity)
207     sql << (v > 0 ? "'infinity'" : "'-infinity'")
208   else
209     super
210   end
211 end
literal_time(time) click to toggle source

Work around JRuby bug #4822 in Time#to_datetime for times before date of calendar reform

Calls superclass method
    # File lib/sequel/extensions/pg_extended_date_support.rb
229 def literal_time(time)
230   if time < TIME_YEAR_1
231     literal_datetime(DateTime.parse(super))
232   else
233     super
234   end
235 end
type_convertor(map, meta, type, i) click to toggle source

Use non-JDBC parsing as JDBC parsing doesn't work for BC dates/timestamps.

Calls superclass method
    # File lib/sequel/extensions/pg_extended_date_support.rb
219 def type_convertor(map, meta, type, i)
220   case type
221   when *CONVERT_TYPES
222     db.oid_convertor_proc(meta.getField(i).getOID)
223   else
224     super
225   end
226 end