X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fmv%2Fplugins%2Fagendav.rb;h=a2fb05438dd0cb5808b45d9d64f80d323fa0b037;hp=fc2a5d9da6572f17981385cd549ec56affa1e8f2;hb=fa7782720ff15fce29b6f875678e9fd0c197485a;hpb=579a22471329c71552bcb4077a0590d60cdec784 diff --git a/lib/mv/plugins/agendav.rb b/lib/mv/plugins/agendav.rb index fc2a5d9..a2fb054 100644 --- a/lib/mv/plugins/agendav.rb +++ b/lib/mv/plugins/agendav.rb @@ -39,8 +39,8 @@ class AgendavMv begin # The "prefs" table uses the normal username as a key... # This should be harmless if the source user does not exist. - sql_query = 'UPDATE prefs SET username = $1 WHERE username = $2;' - connection.query(sql_query, [dst.to_s(), src.to_s()]) + sql_query0 = 'UPDATE prefs SET username = $1 WHERE username = $2;' + connection.sync_exec_params(sql_query0, [dst.to_s(), src.to_s()]) # But the "shares" table uses encoded principal URLs. For the # "shares" table, we need to do a find/replace on the username @@ -53,12 +53,12 @@ class AgendavMv # calendar URL will change when a user moves. This will ALSO # affect people who name their calendars something like # "user%40example.com", but screw those people. - sql_queries << 'UPDATE shares SET owner=REPLACE(owner, $2, $1);' + sql_queries = ['UPDATE shares SET owner=REPLACE(owner, $2, $1);'] sql_queries << 'UPDATE shares SET calendar=REPLACE(calendar, $2, $1);' - sql_queries << 'UPDATE shares SET with=REPLACE(with, $2, $1);' + sql_queries << 'UPDATE shares SET "with"=REPLACE("with", $2, $1);' sql_queries.each do |sql_query| - connection.query(sql_query, [encoded_dst, encoded_src]) + connection.sync_exec_params(sql_query, [encoded_dst, encoded_src]) end ensure # Make sure the connection gets closed even if a query explodes.