Sha256: 7c7010553a8a0d53cec75c297d107ec74f6252f3f09cfeb377e11dfe4ca27e18

Contents?: true

Size: 1.37 KB

Versions: 9

Compression:

Stored size: 1.37 KB

Contents

# frozen-string-literal: true

Sequel::DataObjects.load_driver 'do_postgres'
Sequel.require 'adapters/shared/postgres'

module Sequel
  Postgres::CONVERTED_EXCEPTIONS << ::DataObjects::Error
  
  module DataObjects
    Sequel.synchronize do
      DATABASE_SETUP[:postgres] = proc do |db|
        db.extend(Sequel::DataObjects::Postgres::DatabaseMethods)
        db.extend_datasets Sequel::Postgres::DatasetMethods
      end
    end

    # Adapter, Database, and Dataset support for accessing a PostgreSQL
    # database via DataObjects.
    module Postgres
      # Methods to add to Database instances that access PostgreSQL via
      # DataObjects.
      module DatabaseMethods
        extend Sequel::Database::ResetIdentifierMangling
        include Sequel::Postgres::DatabaseMethods
        
        # Add the primary_keys and primary_key_sequences instance variables,
        # so we can get the correct return values for inserted rows.
        def self.extended(db)
          super
          db.send(:initialize_postgres_adapter)
        end
        
        private
        
        # Extend the adapter with the DataObjects PostgreSQL AdapterMethods
        def setup_connection(conn)
          conn = super(conn)
          connection_configuration_sqls.each{|sql| log_connection_yield(sql, conn){conn.create_command(sql).execute_non_query}}
          conn
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
sequel-4.41.0 lib/sequel/adapters/do/postgres.rb
sequel-4.40.0 lib/sequel/adapters/do/postgres.rb
sequel-4.39.0 lib/sequel/adapters/do/postgres.rb
tdiary-5.0.2 vendor/bundle/gems/sequel-4.37.0/lib/sequel/adapters/do/postgres.rb
sequel-4.38.0 lib/sequel/adapters/do/postgres.rb
sequel-4.37.0 lib/sequel/adapters/do/postgres.rb
sequel-4.36.0 lib/sequel/adapters/do/postgres.rb
tdiary-5.0.1 vendor/bundle/gems/sequel-4.35.0/lib/sequel/adapters/do/postgres.rb
sequel-4.35.0 lib/sequel/adapters/do/postgres.rb