Sha256: a8637ee59ad69e3ebd3f7be014df87031b122b6339830deba6236c2da4f589c2

Contents?: true

Size: 799 Bytes

Versions: 8

Compression:

Stored size: 799 Bytes

Contents

# 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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
simple-sql-0.4.41 lib/simple/sql/connection.rb
simple-sql-0.4.40 lib/simple/sql/connection.rb
simple-sql-0.4.39 lib/simple/sql/connection.rb
simple-sql-0.4.38 lib/simple/sql/connection.rb
simple-sql-0.4.37 lib/simple/sql/connection.rb
simple-sql-0.4.36 lib/simple/sql/connection.rb
simple-sql-0.4.35 lib/simple/sql/connection.rb
simple-sql-0.5.0 lib/simple/sql/connection.rb