]>
gitweb.michael.orlitzky.com - mailshears.git/blob - src/postfixadmin_db.rb
5 def initialize(db_host
,
23 def get_domains_from_db()
24 # Just assume PostgreSQL for now.
26 connection
= PGconn
.connect(@db_host,
34 sql_query
= 'SELECT domain FROM domain;'
35 result
= connection
.query(sql_query
)
38 # But pretend like we're database-agnostic in case we ever are.
39 raise DatabaseError
.new(e
)
42 # The database query returns an array of rows. Since we only asked
43 # for one column (domain), we can flatten the result into an
49 def get_accounts_from_db()
50 # Just assume PostgreSQL for now.
52 connection
= PGconn
.connect(@db_host,
60 # If address = goto, then the alias basically says, "really
61 # deliver to that address; it's not an alias."
62 sql_query
= 'SELECT username FROM mailbox;'
63 result
= connection
.query(sql_query
)
66 # But pretend like we're database-agnostic in case we ever are.
67 raise DatabaseError
.new(e
)
70 # The database query returns an array of rows. Since we only asked
71 # for one column (address), we can flatten the result into an