Sha256: 1d9b0ee5c9baae11b7be69a411e839cdfdda793032f8099d1667567822bf0113

Contents?: true

Size: 953 Bytes

Versions: 3

Compression:

Stored size: 953 Bytes

Contents

class Simple::SQL::Connection
end

require_relative "connection/raw_connection"
require_relative "connection/active_record_connection"

require_relative "connection/reflection"
require_relative "connection/insert"
require_relative "connection/duplicate"

# A Connection object.
#
# A Connection object is built around a raw connection (as created from the pg
# ruby gem).
#
#
# It includes
# the ConnectionAdapter, which implements ask, all, + friends, and also
# includes a quiet simplistic Transaction implementation
class Simple::SQL::Connection
  def self.create(database_url = :auto)
    case database_url
    when :auto
      if defined?(::ActiveRecord)
        ActiveRecordConnection.new
      else
        RawConnection.new Simple::SQL::Config.determine_url
      end
    else
      RawConnection.new database_url
    end
  end

  include Simple::SQL::ConnectionAdapter

  extend Forwardable
  delegate [:wait_for_notify] => :raw_connection
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple-sql-0.5.4 lib/simple/sql/connection.rb
simple-sql-0.5.3 lib/simple/sql/connection.rb
simple-sql-0.5.2 lib/simple/sql/connection.rb