Class: Avmtrf1::Tools::Runner::Oracle::Query

Inherits:
EacRubyUtils::Console::DocoptRunner
  • Object
show all
Includes:
EacCli::DefaultRunner
Defined in:
lib/avmtrf1/tools/runner/oracle/query.rb

Constant Summary collapse

DEFAULT_COLUMN_SEPARATOR =
"\t"
DEFAULT_ROW_SEPARATOR =
"\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



26
27
28
# File 'lib/avmtrf1/tools/runner/oracle/query.rb', line 26

def count
  @count
end

Instance Method Details



40
41
42
43
44
45
46
# File 'lib/avmtrf1/tools/runner/oracle/query.rb', line 40

def print_body
  @count = 0
  cursor.fetch do |row|
    print_row(row)
    @count += 1
  end
end


48
49
50
51
52
# File 'lib/avmtrf1/tools/runner/oracle/query.rb', line 48

def print_footer
  return unless options.fetch('--count')

  print_row(["Count: #{count}"])
end


34
35
36
37
38
# File 'lib/avmtrf1/tools/runner/oracle/query.rb', line 34

def print_header
  return unless options.fetch('--columns')

  print_row(cursor..map(&:name))
end

#runObject



28
29
30
31
32
# File 'lib/avmtrf1/tools/runner/oracle/query.rb', line 28

def run
  print_header
  print_body
  print_footer
end