pgsql_rb_dsltest

Ruby code posted by +1CM
created at 15 Aug 16:51, updated at 15 Aug 16:51

Edit | Back
1
2
3
4
5
6
7
8
require 'rubygems'
require 'sequel'
DB = Sequel.connect('postgres://user:pwd@localhost:5432/mydb')
dataset = DB["SELECT tag FROM blog_posts"]
dataset.map(:tag)
DB.fetch("SELECT tag FROM blog_posts") do |row|
  p row[:tag]
end
234 Bytes in 2 ms with coderay