class Forklift::Base::Connection

Public Class Methods

new(config) click to toggle source
# File lib/forklift/base/connection.rb, line 5
def initialize(config)
  @config = config
end

Public Instance Methods

client() click to toggle source
# File lib/forklift/base/connection.rb, line 13
def client
  @client
end
config() click to toggle source
# File lib/forklift/base/connection.rb, line 9
def config
  @config
end
connect() click to toggle source
# File lib/forklift/base/connection.rb, line 17
def connect
  # Will define @client
  raise 'not implemented'
end
disconnect() click to toggle source
# File lib/forklift/base/connection.rb, line 22
def disconnect
  raise 'not implemented'
end
exec(path, *args) click to toggle source
# File lib/forklift/base/connection.rb, line 41
def exec(path, *args)
  begin
    exec!(path, &args)
  rescue Exception => e
    forklift.logger.log(e)
  end
end
exec!(path, *args) click to toggle source
# File lib/forklift/base/connection.rb, line 49
def exec!(path, *args)
  forklift.logger.log "Running script: #{path}"
  extension = path.split(".").last
  if(extension == "rb" || extension == "ruby")
    exec_ruby(path, *args)
  else
    exec_script(path, *args)
  end
end
exec_ruby(path, *args) click to toggle source
# File lib/forklift/base/connection.rb, line 59
def exec_ruby(path, *args)
  klass = forklift.utils.class_name_from_file(path)
  require path
  model = eval("#{klass}.new")
  model.do!(self, forklift, *args)
end
exec_script(path, *args) click to toggle source
# File lib/forklift/base/connection.rb, line 66
def exec_script(path, *args)
  raise 'not implemented'
end
pipe() click to toggle source
# File lib/forklift/base/connection.rb, line 36
def pipe
  # when copying within the same connection, this method can be defined to speed things up
  raise 'not implemented'
end
read(query) click to toggle source
# File lib/forklift/base/connection.rb, line 26
def read(query)
  # will return an array of data rows
  raise 'not implemented'
end
write(data, collection) click to toggle source
# File lib/forklift/base/connection.rb, line 31
def write(data, collection)
  # will write array data to collection (table)
  raise 'not implemented'
end