Sha256: 8f740046d60e17c3563891f4fd6fdae513c07945f5f7c4b9d69da66671493486

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

class Simple::SQL::Connection
end

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

require_relative "connection/base"
require_relative "connection/lock"
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

5 entries across 5 versions & 1 rubygems

Version Path
simple-sql-0.5.14 lib/simple/sql/connection.rb
simple-sql-0.5.13 lib/simple/sql/connection.rb
simple-sql-0.5.12 lib/simple/sql/connection.rb
simple-sql-0.5.11 lib/simple/sql/connection.rb
simple-sql-0.5.10 lib/simple/sql/connection.rb