]>
gitweb.michael.orlitzky.com - mailshears.git/blob - src/postfixadmin_db.rb
5 def initialize(db_host
,
23 def get_accounts_from_db()
24 # Just assume PostgreSQL for now.
26 connection
= PGconn
.connect(@db_host,
34 # If address = goto, then the alias basically says, "really
35 # deliver to that address; it's not an alias."
36 sql_query
= 'SELECT address FROM alias WHERE address = goto;'
37 result
= connection
.query(sql_query
)
40 # But pretend like we're database-agnostic in case we ever are.
41 raise DatabaseError
.new(e
)
44 # The database query returns an array of rows. Since we only asked
45 # for one column (address), we can flatten the result into an