Sha256: 90c3dd57387ae123fe412845821a6bd65fd7c7f149b5543836cb5079d6f0575b

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 Bytes

Contents

class Simple::SQL::Connection
end

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

require_relative "connection/base"
require_relative "connection/scope"
require_relative "connection/reflection"
require_relative "connection/insert"
require_relative "connection/duplicate"
require_relative "connection/type_info"

# 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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple-sql-0.5.9 lib/simple/sql/connection.rb
simple-sql-0.5.8 lib/simple/sql/connection.rb