<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Pentabarf fix</title>
	<atom:link href="http://dan.langille.org/2011/12/30/pentabarf-fix/feed/" rel="self" type="application/rss+xml" />
	<link>http://dan.langille.org/2011/12/30/pentabarf-fix/</link>
	<description>He has another more popular diary.  This one is more general.</description>
	<pubDate>Fri, 18 May 2012 20:12:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Dan Langille</title>
		<link>http://dan.langille.org/2011/12/30/pentabarf-fix/#comment-586</link>
		<dc:creator>Dan Langille</dc:creator>
		<pubDate>Mon, 02 Jan 2012 20:40:38 +0000</pubDate>
		<guid isPermaLink="false">http://dan.langille.org/?p=374#comment-586</guid>
		<description>See also:


CREATE OR REPLACE FUNCTION auth.activate_account(activation_string character)
 RETURNS integer
 LANGUAGE plpgsql
 STRICT
AS $function$
#variable_conflict use_variable
  DECLARE
    cur_activation RECORD;
    cur_person_id INTEGER;
    activation_interval INTERVAL;
  BEGIN
    activation_interval = '-7 day';
    DELETE FROM auth.account WHERE account_id IN ( SELECT account_id FROM auth.account_activation WHERE account_creation &#60; now() + activation_interval );
    SELECT INTO cur_activation account_id, conference_id FROM auth.account_activation WHERE account_activation.activation_string = activation_string;
    IF FOUND THEN
      INSERT INTO auth.account_role(account_id, role) VALUES (cur_activation.account_id, 'submitter');
      SELECT INTO cur_person_id nextval(pg_get_serial_sequence('base.person','person_id'));
      INSERT INTO person(person_id,nickname,email) SELECT cur_person_id,login_name,email FROM auth.account WHERE account.account_id = cur_activation.account_id;
      UPDATE auth.account SET person_id = cur_person_id WHERE account_id = cur_activation.account_id;
      INSERT INTO auth.account_settings(account_id,current_conference_id) VALUES (cur_activation.account_id, cur_activation.conference_id);
      DELETE FROM auth.account_activation WHERE account_activation.activation_string = activation_string;
    ELSE
      PERFORM 1 FROM log.account_activation WHERE account_activation.activation_string = activation_string AND account_activation.log_operation = 'D';
      IF FOUND THEN
        RAISE EXCEPTION 'Your account has already been activated.';
      ELSE
        RAISE EXCEPTION 'Invalid activation string.';
      END IF;
    END IF;
    RETURN cur_activation.conference_id;
  END;
$function$

</description>
		<content:encoded><![CDATA[<p>See also:</p>
<p>CREATE OR REPLACE FUNCTION auth.activate_account(activation_string character)<br />
 RETURNS integer<br />
 LANGUAGE plpgsql<br />
 STRICT<br />
AS $function$<br />
#variable_conflict use_variable<br />
  DECLARE<br />
    cur_activation RECORD;<br />
    cur_person_id INTEGER;<br />
    activation_interval INTERVAL;<br />
  BEGIN<br />
    activation_interval = &#8216;-7 day&#8217;;<br />
    DELETE FROM auth.account WHERE account_id IN ( SELECT account_id FROM auth.account_activation WHERE account_creation &lt; now() + activation_interval );<br />
    SELECT INTO cur_activation account_id, conference_id FROM auth.account_activation WHERE account_activation.activation_string = activation_string;<br />
    IF FOUND THEN<br />
      INSERT INTO auth.account_role(account_id, role) VALUES (cur_activation.account_id, &#8217;submitter&#8217;);<br />
      SELECT INTO cur_person_id nextval(pg_get_serial_sequence(&#8217;base.person&#8217;,'person_id&#8217;));<br />
      INSERT INTO person(person_id,nickname,email) SELECT cur_person_id,login_name,email FROM auth.account WHERE account.account_id = cur_activation.account_id;<br />
      UPDATE auth.account SET person_id = cur_person_id WHERE account_id = cur_activation.account_id;<br />
      INSERT INTO auth.account_settings(account_id,current_conference_id) VALUES (cur_activation.account_id, cur_activation.conference_id);<br />
      DELETE FROM auth.account_activation WHERE account_activation.activation_string = activation_string;<br />
    ELSE<br />
      PERFORM 1 FROM log.account_activation WHERE account_activation.activation_string = activation_string AND account_activation.log_operation = &#8216;D&#8217;;<br />
      IF FOUND THEN<br />
        RAISE EXCEPTION &#8216;Your account has already been activated.&#8217;;<br />
      ELSE<br />
        RAISE EXCEPTION &#8216;Invalid activation string.&#8217;;<br />
      END IF;<br />
    END IF;<br />
    RETURN cur_activation.conference_id;<br />
  END;<br />
$function$</p>
]]></content:encoded>
	</item>
</channel>
</rss>

