diff --git a/helloworld.rb b/helloworld.rb index a4c62c4..592ac11 100644 --- a/helloworld.rb +++ b/helloworld.rb @@ -17,9 +17,14 @@ puts 'Successfully created connection to database.' resultSet = connection.exec('SELECT * from demotable;') + outStr = "" resultSet.each do |row| puts 'Data row = (%s, %s)' % [row['id'], row['name']] + row_data = "" + outStr += "#{row_data}" end + outStr += "
idname
#{row['id']}#{row['name']}}
" + outStr rescue PG::Error => e puts e.message @@ -27,5 +32,4 @@ ensure connection.close if connection end - 'Hello World!' end