File: email.rb

Project: Invitation to Ruby

#!/usr/bin/env ruby

require 'dbi'

db = DBI.connect ("DBI:Pg:jim", "jim")

sql = <<-SQL
SELECT email
FROM person, email
WHERE person.personid = email.personid
AND person.nick = ? 
ORDER BY nick, type
SQL

db.select_all(sql, ARGV[0]) { |row|
  puts row[0]
}
db.disconnect

Used by: email0 email1 emailtable emailtable2


[ Index ][ Table of Contents ]
Generated by [ source2html ]