view staff/mackey/academy/db.rb @ 3944:e45173af0101 default tip master

chenge game link
author KOMATSU Kotaro <c118089@roy.e.koeki-u.ac.jp>
date Mon, 20 Jan 2020 18:13:48 +0900
parents b56bf1659fd5
children
line wrap: on
line source

#!/usr/bin/ruby
# coding: utf-8

require"rubygems"
require"pg"

begin
  conn = PGconn.connect('127.0.0.1','','','','semi','masahiro','l3nl3q1u')
  q = "select question, word1, word2, word3, word4 from quiz"
  res = conn.exec(q)
  res.each do |row|
    puts row["question"].to_s + ":" + row["word1"].to_s + ":" + row["word2"].to_s + ":" + row["word3"].to_s + ":" + row["word4"].to_s
  end
ensure
  conn.close if conn
end

yatex.org