X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Fpostfixadmin_plugin.rb;h=92b7a5b3036cdc8be3bba7df549d9d026cf8e87f;hp=08fca7d32efe77d488328f4ff41e4a7c1e0eaaf5;hb=fa7782720ff15fce29b6f875678e9fd0c197485a;hpb=b947ef8844f090eedd50be0383abe417d910bb1a diff --git a/lib/common/postfixadmin_plugin.rb b/lib/common/postfixadmin_plugin.rb index 08fca7d..92b7a5b 100644 --- a/lib/common/postfixadmin_plugin.rb +++ b/lib/common/postfixadmin_plugin.rb @@ -43,7 +43,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 +68,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 +104,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 +131,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 +163,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()