我有以下 Ruby 代码:
94 def open_connection(info)
95 self.log "opening #{info.inspect}"
96 db = Mysql.init
97 db.options(Mysql::SET_CHARSET_NAME, 'utf8')
98 db.real_connect(info.host, info.user, info.password, info.dbname, info.port)
99 db.query("SET NAMES utf8")
100 »···res = db.query("SELECT realname FROM profiles")
101
102 »···conn = PGconn.connect("localhost", 5432, '', '', "dbname", "user", "pwd")
如何获取res
变量并循环遍历它以将其插入我的 Postgres 数据库?