Ruby 连接到 PostgreSQL 并执行查询

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require 'postgres'
conn = PGconn.connect("",5432, "", "", "testdb")

conn.exec("create table rtest ( number integer default 0 );")
conn.exec("insert into rtest values ( 99 )")
res = conn.query("select * from rtest")
# res id [["99"]]