Method: Sequel::Postgres::ExtendedDateSupport.extended

Defined in:
lib/sequel/extensions/pg_extended_date_support.rb

.extended(db) ⇒ Object

Add dataset methods and update the conversion proces for dates and timestamps.

[View source]

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/sequel/extensions/pg_extended_date_support.rb', line 35

def self.extended(db)
  db.extend_datasets(DatasetMethods)
  procs = db.conversion_procs
  procs[1082] = ::Sequel.method(:string_to_date)
  procs[1184] = procs[1114] = db.method(:to_application_timestamp)
  if ocps = db.instance_variable_get(:@oid_convertor_map)
    # Clear the oid convertor map entries for timestamps if they
    # exist, so it will regenerate new ones that use this extension.
    # This is only taken when using the jdbc adapter.
    Sequel.synchronize do
      ocps.delete(1184)
      ocps.delete(1114)
    end
  end
end