class Purview::Connections::Base

Attributes

raw_connection[R]

Public Class Methods

connect(opts) click to toggle source
# File lib/purview/connections/base.rb, line 4
def self.connect(opts)
  new(opts)
end
new(opts) click to toggle source
# File lib/purview/connections/base.rb, line 8
def initialize(opts)
  @raw_connection = raw_connection_type.connect(opts)
end

Public Instance Methods

disconnect() click to toggle source
# File lib/purview/connections/base.rb, line 12
def disconnect
  raw_connection.disconnect
  @raw_connection = nil
  self
end
execute(sql) click to toggle source
# File lib/purview/connections/base.rb, line 18
def execute(sql)
  raw_connection.execute(sql)
end
with_transaction() { || ... } click to toggle source
# File lib/purview/connections/base.rb, line 22
def with_transaction
  raw_connection.with_transaction { yield }
end

Private Instance Methods

raw_connection_type() click to toggle source
# File lib/purview/connections/base.rb, line 30
def raw_connection_type
  raise %{All "#{Base}(s)" must override the "raw_connection_type" method}
end