]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/postfixadmin_plugin.rb
mailshears.gemspec: update the version to 0.0.5.
[mailshears.git] / lib / common / postfixadmin_plugin.rb
index 08fca7d32efe77d488328f4ff41e4a7c1e0eaaf5..b4c9030cc9b0829785fd2c08c8b5196914e6767a 100644 (file)
@@ -20,7 +20,6 @@ module PostfixadminPlugin
       :host     => cfg.postfixadmin_dbhost,
       :port     => cfg.postfixadmin_dbport,
       :options  => cfg.postfixadmin_dbopts,
-      :tty      => cfg.postfixadmin_dbtty,
       :dbname   => cfg.postfixadmin_dbname,
       :user     => cfg.postfixadmin_dbuser,
       :password => cfg.postfixadmin_dbpass }
@@ -43,7 +42,7 @@ module PostfixadminPlugin
     sql_query = "SELECT domain FROM domain WHERE domain <> 'ALL';"
 
     begin
-      connection.query(sql_query) do |result|
+      connection.sync_exec(sql_query) do |result|
         domains = result.field_values('domain')
       end
     ensure
@@ -68,7 +67,7 @@ module PostfixadminPlugin
     sql_query = 'SELECT username FROM mailbox;'
 
     begin
-      connection.query(sql_query) do |result|
+      connection.sync_exec(sql_query) do |result|
         users = result.field_values('username')
       end
     ensure
@@ -104,7 +103,7 @@ module PostfixadminPlugin
     begin
       # Now replace each Domain with its string representation and pass
       # those in as our individual parameters.
-      connection.query(sql_query, domains.map{ |d| d.to_s() }) do |result|
+      connection.sync_exec_params(sql_query, domains.map{ |d| d.to_s() }) do |result|
         usernames = result.field_values('username')
       end
     ensure
@@ -131,7 +130,7 @@ module PostfixadminPlugin
     sql_query = 'SELECT address,goto FROM alias;'
 
     begin
-      results = connection.query(sql_query)
+      results = connection.sync_exec(sql_query)
       results.each do |row|
         # row should be a hash
         aliases << row
@@ -163,7 +162,7 @@ module PostfixadminPlugin
     sql_query = 'SELECT COUNT(domain) as count FROM domain WHERE domain = $1;'
 
     begin
-      connection.query(sql_query, [domain.to_s()]) do |result|
+      connection.sync_exec_params(sql_query, [domain.to_s()]) do |result|
         return false if result.ntuples() < 1
         count = result.getvalue(0,0).to_i()