Ich habe Schwierigkeiten mit der Postgresql-Ausgabe in Ruby angezeigt und auch, wenn es eine Möglichkeit gibt, die gleiche Ausgabe in HTML zu drucken.Postgresql-Recordset-Ausgabe-Anzeige in Ruby Gurke
Da unten ist der Code und Fehler:
Then(/^selecting source table$/) do
require 'pg'
conn = PGconn.connect("localhost",5433,'','', "db", "postgres", "pass")
result = conn.exec('select EMP_ID,DEPT_ID,DEPT_NAME,EMP_NAME from EMP_TABLE')
result.each do |row|
puts row['EMP_ID'] + ' | ' + row['DEPT_ID'] + ' | ' + row['DEPT_NAME'] + ' | ' + row['EMP_NAME']
end
end
ERROR:
NoMethodError: undefined method +' for nil:NilClass
./features/step_definitions/my_steps.rb:45:inblock (2 levels) in ' ./features/step_definitions/my_steps.rb:44:in each'
./features/step_definitions/my_steps.rb:44:in/^selecting source table$/' ./features/PG.feature:12:in `Then selecting source table' 1 scenario (1 failed) 1 step (1 failed) 0m0.072s