class Janko::InsertImporter

Public Instance Methods

push(values) click to toggle source
# File lib/janko/insert_importer.rb, line 16
def push(values)
    connection.exec_prepared(statement_name, columns.pack(values))
    self
end
start() click to toggle source
# File lib/janko/insert_importer.rb, line 9
def start
    query = sprintf("INSERT INTO %s(%s) VALUES(%s)", table,
        columns.to_list, columns.to_binds)
    connection.prepare(statement_name, query)
    self
end
stop() click to toggle source
# File lib/janko/insert_importer.rb, line 21
def stop
    connection.exec("DEALLOCATE \"#{statement_name}\"")
    self
end

Private Instance Methods

statement_name() click to toggle source
# File lib/janko/insert_importer.rb, line 28
def statement_name
    @statement_name ||= "import-#{SecureRandom.hex(8)}"
end