Class: JRubySQL::Output::CSV

Inherits:
Object
  • Object
show all
Defined in:
lib/jrubysql/output/csv.rb

Instance Method Summary collapse

Instance Method Details

#cursor(empty) ⇒ Object



21
22
23
# File 'lib/jrubysql/output/csv.rb', line 21

def cursor empty
  ''
end

#error(msg) ⇒ Object



16
17
18
# File 'lib/jrubysql/output/csv.rb', line 16

def error  msg
  $stderr.puts "[E] #{msg}"
end

#info(msg) ⇒ Object



7
8
9
# File 'lib/jrubysql/output/csv.rb', line 7

def info   msg
  $stderr.puts "[I] #{msg}"
end


25
# File 'lib/jrubysql/output/csv.rb', line 25

def print_cursor empty; end


19
# File 'lib/jrubysql/output/csv.rb', line 19

def print_help; end


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/jrubysql/output/csv.rb', line 27

def print_result ret
  if ret[:set?]
    ret[:result].each_with_index do |row, idx|
      puts ::CSV.generate_line(row.labels) if idx == 0
      puts ::CSV.generate_line row.map { |col|
        case col
        when BigDecimal
          col.to_s('F')
        else
          col
        end
      }
    end
  end
end

#result(msg) ⇒ Object



10
11
12
# File 'lib/jrubysql/output/csv.rb', line 10

def result msg
  $stderr.puts "[R] #{msg}"
end

#warn(msg) ⇒ Object



13
14
15
# File 'lib/jrubysql/output/csv.rb', line 13

def warn   msg
  $stderr.puts "[W] #{msg}"
end

#welcome!Object



6
# File 'lib/jrubysql/output/csv.rb', line 6

def welcome!;   end